tdau

To backup mode or not to backup mode?  That is the question.

Blog Post created by tdau Employee on Jun 25, 2013

backupmode

Have you ever wonder whether or not you need to put your Oracle DB in backup mode before taking a SAN snapshot for backup?  If yes, then please read on…

This depends on how you want to do a database recovery using the SAN snapshot.  The questions are:

  1. Do you want to recover the database from the snapshot as is?  Meaning, if I take a SAN snapshot of my database at 10:00am and by 11:00am, my database corrupts.  I would mount the 10:00am snapshot back to my database server and start it.  I would lose one hour worth of data.  If the answer is yes, then you don’t need to put the database in backup mode before taking a SAN snapshot.  It is similar to if you were to walk up to your database server and hit the power button.  When the database starts up, it will recover itself.
  2. Do you want to recover the database from the snapshot and still have the ability to roll forward the database up to the last available archive log?  Meaning, if I take a SAN snapshot of my database at 10:00am and by 11:00am, my database corrupts.  I would mount the 10:00am snapshot back to my database server and recover it using the available archive logs up to the moment before the corruption.  If the answer is yes, then you need to put the database in backup mode.  Note:  In order to use the backup mode feature, the database must be running in archive log mode.

Here is a brief explanation of backup mode.  When the Oracle database is in backup mode, the database copies whole changed data blocks into the redo stream.  This will generate a lot of redo while the database is in backup mode.  The cool thing about Oracle is that it will not prevent you from using the database while in backup mode.  After you have taken a SAN snapshot, make sure to take the database out of backup mode.  This will allow the database to advance the data file headers to the current database check point.  When restoring a data file using the snapshot, the database asks for the appropriate set of redo log files to apply if recovery is needed in order to make the data file consistent.

Outcomes