BNFD - Your DBA NoteBook On The Net!!!

Monday, October 27, 2008

Hot Backup in Oracle

When datafiles are put into hot backup mode, Oracle is still writing to them
Oracle slightly changes the way it performs updates to datafiles by copying whole datafile blocks, rather changed bytes , into the online redo logs.
Hot backups, by their very nature,take a corrupt copy of the datafiles.Since the instance is in ARCHIVELOG mode, all changes to the datafiles are available upon restore to correct any discrepancies created as the archiving process passes over any given datafile. This is why Oracle records redo information in whole blocks during hot backup: to help recover any inconsistent blocks in the datafiles upon restore.
And also during Hot backup mode oracle doesnt update the SCN in the header of the Datafile.
Online redo log files should never be backed up in hot backup mode.

STEPS:
1)Get listing of tablespaces and datafiles
(SELECT tablespace_name, file_name FROM sys.dba_data_files).

2. For each tablespacea) Put tablespace in hot backup mode
(ALTER TABLESPACE $TABLESPACENAME BEGIN BACKUP).
b) Copy, archive, or snapshot each datafile in this tablespace.
c) End hot backup mode for this tablespace
(ALTER TABLESPACE $TABLESPACENAME END BACKUP).

3. Backup the Oracle “controlfile”
(ALTER DATABASE BACKUP CONTROLFILE to trace)

4. Confirm all tablespaces returned to normal mode (SELECT FILE#,STATUS,CHANGE#,TIME FROM v$backup WHERE STATUS != 'NOT ACTIVE').

5.ALter System switch logfile ( it ll force the checkpoint which ll update SCN in the datafiles header)

6. Perform an archive log switch (ALTER SYSTEM ARCHIVE LOG CURRENT).
7. Backup archived redo logs.

No comments: