Wednesday, July 18, 2012

Hot Backup

Put the tablespace in the Backup mode and copy the data files.

alter tablespace USERS begin backup;
select file_name from dba_data_files where tablespace_name='USERS';

$cp /u01/oracle/users01.dbf /u10/backup
$cp /u01/oracle/users02.dbf /u10/backup

The following command ends the backup process and puts the tablespace back in normal mode.
alter tablespace USERS end backup;

You have to repeat this process for all tablespaces. You can get the list of tablespaces by using the following SQL statement:

select tablespace_name from dba_tablespaces;

Back up the control and Init.ora files.

alter database backup controlfile to '/u10/backup/control.ctl';

You can copy the Init.ora file to a backup location using

$cp $ORACLE_HOME/dbs/initorcl.ora /u10/backup

Stop archiving.

alter system switch logfile;
alter system archive log stop;
The first command switches redo log file and the second command stops the archiver process.

Back up the archive files.

The archive file location is defined by the LOG_ARCHIVE_DEST_n parameter in the Init.ora file.

select min(sequence#) from v$log where archived='NO';

Restart the archive process.

alter system archive log start;

No comments:

Post a Comment