Recovering a Standby database from a missing archivelog



Last updated on December 21st, 2015 at 08:02 am

A Physical Standby database relies on continuous application of archivelogs from a Primary Database to be in synch with it. In Oracle Database versions prior to 10g in the event of an archivelog gone missing or corrupt you had to rebuild the standby database from scratch.

 

From 10g you can use an incremental backup from SCN and recover the standby using the same to compensate for the missing archivelogs as shown below

So here are the steps for Recovering a Standby database from a missing archivelog

Step 1: On the standby database check the current scn.

STDBY> set numwidth 30;
STDBY> select current_scn from v$database;

CURRENT_SCN
———–
6746747647647

Step 2: On the primary database create the needed incremental backup from the above SCN

rman target /

RMAN> {
allocate channel c1 type disk;
BACKUP INCREMENTAL FROM SCN 6746747647647 DATABASE
FORMAT /tmp/inc_standby_%U’;
}

We can parallel worker to speed up the backup creation if the database has generated lot of changes

Step 3: Cancel managed recovery at the standby database

STDBY>alter database recover managed standby database cancel;
Media recovery complete.

scp the backup files to standby server to /tmp folder.

Step 4: Catalog the Incremental Backup Files at the Standby Database

rman target /

RMAN> CATALOG START WITH ‘/tmp/’;
searching for all files that match the pattern /tmp/

List of Files Unknown to the Database
=====================================
……

Do you really want to catalog the above files (enter YES or NO)? YES
cataloging files…
cataloging done

Step 5: Apply the Incremental Backup to the Standby Database
rman target /

RMAN>
RECOVER DATABASE NOREDO;

Step 6: Put the standby database back to managed recovery mode.

recover managed standby database disconnect;
Media recovery complete.

From the alert.log you will notice that the standby database is still looking for the old log files

*************************************************
FAL[client]: Failed to request gap sequence
GAP – thread 1 sequence ….
**************************************************

This is because the controlfile has not been updated.
Hence the standby controlfile has to be recreated

Step 7: On the primary create new standby controlfile
alter database create standby controlfile as ‘/tmp/standby01.ctl’;
System altered.

Step 8: At Standby .. Replace standby controlfile at all location as shown by controle_files parameter.

Copy the standby control file to the standby site. Shutdown the stanby database and replace the stanby controlfiles and restart the standby database in managed recovery mode…

Note: – FOR STANDBY DATABASES ON ASM additional steps is required after replacing the stanby control file. Like renaming datafiles …


Leave a Reply