About Me

Sunday, 16 September 2012

Using RMAN Incremental Backups to Roll Forward a Physical Standby Database in 10 Steps



There are several scenarios that can occur in an Oracle Data Guard configuration which renders a physical standby database as either unusable or invalid. For example, an extended network failure can occur between the primary and standby machines which cause the standby database to fall significantly far behind the primary database. If the necessary archived redo log files needed to synchronize the physical standby database with the primary database are no longer available, log gap resolution will be unable to resolve the gap in the redo stream to catch up the standby.

1.       On the physical standby database, stop the managed recovery process (MRP):
   
    SQL> alter database recover managed standby database cancel;

2.      On the physical standby database, find the SCN which will be used for the incremental backup at the primary database, as the backup must be created from this SCN forward.

         SQL> select current_scn from v$database;
 
                 CURRENT_SCN
                 -----------
                                      3744425

3.       Record the SCN returned from the above query for the next step.

4.       Using RMAN, connect to the primary database and create an incremental backup from the SCN derived in the previous step.
         RMAN> backup incremental from scn 3744425 database format                     
                       '/u01/bkp/ForStandby_%U.inc' tag 'FORSTANDBY';
 
5.      Create new standby controlfile on production database.
  
     SQL>alter database create standby controlfile as 

                '/u01/bkp/CONTROL01.CTL’;

6.      Ship all the incremental backups and new standby controlfile to DR site. Let me assume that we have created '/u01/bkp/’ directory at DR site also to keep all the incremental backups and new standby controlfile.

7.       After copying the incremental backup pieces to the physical standby machine, connect to the physical standby database using RMAN and catalog those incremental backup pieces. Then recover the standby database with the cataloged incremental backup pieces.

       RMAN> catalog start with '/u01/bkp/’;

       RMAN> recover database noredo;

8.      Shutdown the standby database and rename all the old standby controlfiles.  
Replace all the old standby controlfile with new ones that you have brought from production site.

RMAN> shutdown;

9.      Now we can start the physical standby database.

           RMAN> startup mount;

10.  Keep physical standby database again in managed recovery mode and take some 
   Manual log switches at production site to see whether archives are transferring to  
   Recovered standby and applying or not. Wait and test again.

   SQL>alter database recover managed standby database disconnect from session;

   SQL>select sequence#, archived, applied from v$archived_log;