PDA

View Full Version : Archive log file missing - How to Resync the standby database using RMAN incremental


Arjen Visser
02-09-2012, 02:42 PM
Occasionally there is an archive log file missing from the primary which is needed by the standby database to keep it up to date. The standby database must have all archive log files and no archive log file can be skipped.

If an archive log file is missing Dbvisit Standby usually reports this with the Archive log missing error (Return code = 6001).

When this happens there are 3 options:
1) Restore the missing archive from backup on the primary server and Dbvisit Standby will be able to pick it up and transfer to the standby server to apply to the standby database.
2) Rebuild the standby database. The standby database can be rebuild using the CSD (create standby database) wizard in Dbvisit Standby. This can be through the Web interface or through the command line (dbvisit_setup).
3) Resync the standby database using an incremental RMAN backup from the primary database. This does not require a full rebuild of the standby database and can be a lot more efficient.

The steps to resync the standby database using an incremental RMAN backup from the primary database are as follows.

1. Obtain current SCN from the standby:
SQL> SELECT CURRENT_SCN FROM V$DATABASE;
CURRENT_SCN
-----------
233995
2. Connect to the primary database as the RMAN target and create an incremental backup from the current SCN (for a standby lagging far behind the primary):
RMAN> BACKUP INCREMENTAL FROM SCN 233995 DATABASE FORMAT '/tmp/ForStandby_%U'
3. Transfer all the backup pieces created on the primary to the standby
4. Catalog backup pieces if the location on the standby is different from the primary
5. Create a standby controlfile on the primary and ship to the standby
6. Recreate the standby controlfile on the standby:
SQL> shutdown abort
SQL> startup nomount
RMAN> RESTORE STANDBY CONTROLFILE FROM '';
SQL> alter database mount standby database;
7. Rename standby data/temp files and redo if different from the primary using ALTER DATABASE RENAME FILE
8. Apply incremental backup to the standby:
RMAN> RECOVER DATABASE NOREDO;


SPECIAL NOTE As of Dbvisit Standby 6.0.34, there is an automatic resync feature to automate the above process. Please see http://blog.dbvisit.com/synchronize-your-standby-database-using-dbvisit-standby/