Saturday, June 7, 2008

User Managed Backups

USER MANAGED BACKUPS

SQL>select name from v$controlfile;

SQL>select member from V$logfile;

SQL>select name from v$datafile;

SQL>shu immediate;

Now copy all the above files at a backup location manually using OS Command.

SQL>startup ;

  • WHOLE DATABASE ONLINE / HOT / INCONSISTENT BACKUP

Database must be in archive log mode

SQL> alter database begin backup;

Copy all datafiles to backup location

SQL> alter database end backup;

Switch logfile

SQL> alter system switch logfile;

Create controlfile backup

SQL> alter database backup controlfile to 'e:\backup\control01.ctl';

Create spfile backup

SQL> create pfile='e:\backup\init.ora' from spfile;

Now user managed hot backup is complete.


  • ONLINE TABLESPACE BACKUP

Database must be in archive log mode

SQL> alter tablespace example begin backup;

Copy the datafile of the tablespace example to a backup location

To check the status of the file which are left active in backup mode

SQL>select file#, status from v$backup;

SQL>alter tablespace example end backup;

  • METHODS OF TAKING CONTROL FILE BACKUP

Two ways with which one you can create a binary file and with other a text file.

For Binary file creation

SQL>alter database backup controlfile to ‘D:\backup\ctrl.ctl’;

For Text File

SQL>alter database backup controlfile to trace;

( It will be created in UDUMP folder )