Friday, June 7, 2013

Use rman increamental backup to re-sync a physical standby database


Problem description:

Got following error in standby alert log:

Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE  THROUGH ALL SWITCHOVER DISCONNECT  USING CURRENT LOGFILE
Media Recovery Log +DBA_FLASH/dbalc/archivelog/2013_06_06/thread_1_seq_952.3228.817406977
Errors with log +DBA_FLASH/dbalc/archivelog/2013_06_06/thread_1_seq_952.3228.817406977
MRP0: Background Media Recovery terminated with error 328
Errors in file /u02/oracle/diag/DBAPRD/diag/rdbms/dbalc/DBALC/trace/DBALC_mrp0_2283.trc:
ORA-00328: archived log ends at change 324705843, need later change 324707097
ORA-00334: archived log: '+DBA_FLASH/dbalc/archivelog/2013_06_06/thread_1_seq_952.3228.817406977'
Managed Standby Recovery not using Real Time Apply
Shutting down recovery slaves due to error 328
Recovery interrupted!
Errors in file /u02/oracle/diag/DBAPRD/diag/rdbms/dbalc/DBALC/trace/DBALC_mrp0_2283.trc:
ORA-00328: archived log ends at change 324705843, need later change 324707097
ORA-00334: archived log: '+DBA_FLASH/dbalc/archivelog/2013_06_06/thread_1_seq_952.3228.817406977'
MRP0: Background Media Recovery process shutdown (DBALC)


Cause:

The issue can be due to many reasons related to archived logs and SCN having wrong meta data.
Standby Oracle control file is looking for a specific Archivelog specific SCN which it thinks is required for Recovery 
is not available in the archived log. 


Action Plan:

Using RMAN Incremental Backups to Roll Forward a Physical Standby Database
http://docs.oracle.com/cd/E11882_01/server.112/e25608/rman.htm#CIHIAADC


1 Stop Redo apply and get the SCN on standby database

SQL>  ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
SQL>  SELECT CURRENT_SCN FROM V$DATABASE;

CURRENT_SCN
-----------
  324714843

2 Backup incremental from SCN on primary database

RMAN> BACKUP INCREMENTAL FROM SCN 324714843 DATABASE FORMAT '/datapump/ForStandby_%U' tag 'FORSTANDBY';


3 Copy backup from primary to standby

4 Catalog the backup on standby database

RMAN> CATALOG START WITH '/datapump/ForStandby';

5 Recover the standby database with the cataloged incremental backup

RMAN> RECOVER DATABASE NOREDO;

you may need to restore standby control first if above command failed.

RMAN> STARTUP FORCE NOMOUNT;
RMAN> RESTORE STANDBY CONTROLFILE FROM TAG 'FORSTANDBY';
RMAN> ALTER DATABASE MOUNT;
RMAN> RECOVER DATABASE NOREDO;

6 Restart Standby database and start redo apply.

No comments:

Post a Comment