Tuesday, 12 May 2015

How to sync oracle data guard DR with missing archive log in PROD and DR

If we have missing archive log in PROD and DR and the data sync is stopped due to that then we can use incremental backup from SCN option to re-initiate the online sync b/w DR and PROD.

Step-1:
Check the scn no in DR DB where the it stopped DR sync

Step-2:
Take incremental backup from the step-1 scn in PROD.
Take latest's standby control-file from PROD.
then copy the backup to DR

Step-3:
Stop the recovery in DR
In RMAN catalog the RMAN backup's 
Recover the database with noredo

Step-4:
shut down the DR db and start in nomount.
Restore the standby controlfile.
alter the database in mount and start the recovery.

Details step's:
Step-1:In DR
SQL> SELECT to_char(CURRENT_SCN) FROM V$DATABASE;

Step-2: In PROD
RMAN> BACKUP INCREMENTAL FROM SCN <Output of step-1> DATABASE FORMAT '/Backuplocation/Db_Inc_Backup_DB_name_%U.bak' tag 'Forstanby';
RMAN> BACKUP CURRENT CONTROLFILE FOR STANDBY FORMAT '/Backuplocation/ForStandbyCTRL.bck';
Scp the incremental copy to DR    

Step-3: In DR
Cancel the recovery
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE cancel;

Log in the RMAN and catalog backup
RMAN> catalog start with '/Backuplocation/';

Recover using RMAN
RMAN> RECOVER DATABASE NOREDO;

Step-4:In DR
Restoring standby control file.
RMAN> shutdown;
RMAN> startup nomount;
RMAN> RESTORE STANDBY CONTROLFILE FROM '/Backuplocation/ForStandbyCTRL.bck';

RMAN> shutdown;
RMAN> startup mount;

In Sqlplus start the recovery.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

++ Check the max log both in prod and DR
SQL> select thread#, max(sequence#) from v$log_history group by thread# order by thread#;

Misc:
Command's for DR check.
SELECT MESSAGE FROM V$DATAGUARD_STATUS;
SELECT ERROR,STATUS FROM GV$ARCHIVE_DEST WHERE DEST_ID=2;
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=DEFER;
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;
SELECT ERROR,STATUS FROM GV$ARCHIVE_DEST WHERE DEST_ID=2;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

SELECT MIN(FHSCN) FROM X$KCVFH;
SELECT MAX(SEQUENCE#) FROM V$LOG_HISTORY;
ps -ef | grep -i arc
kill -9 <from the above of the DB process id>

Ref:Logs are not shipped to the physical standby database (Doc ID 1130523.1)

No comments: