René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Hot Backup in Oracle

Basic procedure for a hot backup

The following pseudo code(!) demonstrates how a hot backup is taken on Oracle.
for ts in tablespaces
  alter tablespace $ts begin backup
  for df in datafiles of $ts
    cp $df $SAVE/$df
    alter database datafile '$df' end backup
  end
  alter tablespace end backup
end
alter system switch logfile
alter database backup controlfile to trace
The second last step (alter system switch logfile) forces a checkpoint which in turn updates the datafile headers with a new SCN that is the same for all datafile headers.
Note: Online redo log files should never be backed up!

Differences while hot backup and normal db operation

If the database is hot backuped, the operation is different from normal db operation in only two ways:
  • When a database block is modified the first time since the backup started, the entire block is written to the online redo logs. In normal operation, only the changed bytes are written.
  • The datafile headers are not updated with the SCN when a checkpoint is performed.

Prerequisites

Two prerequisites must be met for hot backups to make sense: 1) The database must be in archive log mode and 2) all archived redo logs since the last backup are available when a database must be recovered.