Tuesday, August 16, 2011

ALTER DATABASE {BEGIN|END} BACKUP;

During an Oracle tablespace hot backup, your (or your script) puts a tablespace into backup mode, then copies the datafiles to disk or tape, then takes the tablespace out of backup mode. These steps are widely understood by most DBAs.

However, there is a popular misconception that datafiles are “quiesced,” “frozen,” “offlined” or “locked” during backup mode. So many people think it is true, that it appears in some books on Oracle and on numerous websites. Some have even reported that they learned this from DBA class instructors.

The myth has a couple permutations. One is that while the datafiles are allegedly not writable, changes are stored somewhere in the SGA, the redologs, the rollback segments or some combination thereof, then written back into the datafile when the tablespace is taken out of backup mode. There is a passage in the SAMS title Oracle Unleashed describing this supposed mechanism.

No No No! Stop making stuff up! Oracle’s tablespace hot backup does not work this way at all. It is actually a simple, elegant and failure-resistant mechanism. It absolutely does not stop writing to the datafiles. It actually allows continued operation of the database almost exactly as during normal operation. Contrary to the characterization as “complex”, it can be summarized in a few steps:

** DBWn checkpoints the tablespace (writes out all dirty blocks as of a given SCN)

** CKPT stops updating the Checkpoint SCN field in the datafile headers and begins updating the Hot Backup Checkpoint SCN field instead

** LGWR begins logging full images of changed blocks the first time a block is changed after being written by DBWn
From: Oracle tablespace hot backup mode revisited

Oracle 10g Doc: ALTER DATABASE BACKUP Clauses

Oracle 11g Doc: ALTER DATABASE BACKUP Clauses

Metalink Article: What Happens When A Tablespace/Database Is Kept In Begin Backup Mode [ID 469950.1]

No comments:

Post a Comment