Friday, November 25, 2011

Recover using a backup of a previous incarnation

Beginning with Oracle Database 10g, backup can be restored from a previous incarnation and recovered through a resetlogs command. You simply need to restore and recover your database as required by the type of failure. In this example, the control files and all datafiles are restored:

RMAN> connect target /
RMAN> startup nomount;
RMAN> restore controlfile from autobackup;
RMAN> alter database mount;
RMAN> restore database;
RMAN> recover database;
RMAN> alter database open resetlogs;

When recover command is issued, you should see redo being applied from the previous incarnation of the database and then the current incarnation. In this example,

the previous incarnation has logs 91 through 93, and the current incarnation has logs 1 and 2:

archive log filename … thread=1 sequence=91
archive log filename … thread=1 sequence=92
archive log filename … thread=1 sequence=93
archive log filename … thread=1 sequence=1
archive log filename … thread=1 sequence=2

When to Open the database with resetlogs command ?

When following two conditions are met
1. Incomplete recovery
2. Recover with backup control file

Prior to Oracle Database 10g, you were required to take a backup of your database immediately after you reset the online redo log files. This is because resetting the online redo log files creates a new incarnation of your database and resets your log sequence number back to 1. Any backups taken before resetting the logs could not be easily used to restore and recover your database.

Starting with Oracle Database 10g, there is a new feature known as simplified recovery through resetlogs. This feature allows you to restore from a backup from a previous incarnation of your database and issue restore and recovery commands as applicable to the type of failure that has occurred.

Oracle keeps track of log files from all incarnations of your database. The V$LOG_HISTORY
view is no longer cleared out during a resetlogs operation and contains information for the cur-
rent incarnation as well as any previous incarnations.

Reference: RMAN Recipe of 11g

No comments:

Post a Comment