Thursday, January 16, 2020

Physical standby archive log huge lag , recover using incremental backup

Physical standby archive log huge lag , recover using incremental backup

First Check SCN on Standby from that point we have to recover it.


Take RMAN incremental backup on Primary:
========================================
RMAN> run {
allocate channel c1 type disk format '/u04/app/oracle/flash_recovery_area/PROD11/backupset/for_stand/rman_inc_bkp%U.bkp';
backup incremental from scn 2441246 database;
}


Create control file for standby on Primary:
=============================================
alter database create standby controlfile as 'u04/app/oracle/flash_recovery_area/PROD11/backupset/for_stand/standby.ctl';


Copy the files ( standby control file and rman backup pieces ) to Standby
==============================================

cd /u04/app/oracle/flash_recovery_area/PROD11/backupset/for_stand
scp * oracle@stand.example.com:/u04/app/oracle/flash_recovery_area/PROD11/backupset/for_stand/


Rename control file on Standby:
=============================================
cd /u04/app/oracle/flash_recovery_area/PROD11/backupset/for_stand/
cp standby.ctl /u04/app/oracle/oradata/prod11dg/control01.ctl
cp /u04/app/oracle/oradata/prod11dg/control01.ctl /u04/app/oracle/flash_recovery_area/prod11dg/control02.ctl

Start standby and mount it using currently restored controlfile
=============================================

alter database mount standby database;

rman target /
catalog start with '/u04/app/oracle/flash_recovery_area/PROD11/backupset/for_stand';
recover database;


You might get below error but it is expected:
===========================================
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 145 and starting SCN of 2450781

Start MRP process and check SYNC
===========================================
alter database recover managed standby database disconnect from session;

SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference" FROM (SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH,(SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL WHERE ARCH.THREAD# = APPL.THREAD# ORDER BY 1;

    Thread Last Sequence Received Last Sequence Applied Difference
---------- ---------------------- --------------------- ----------
         1                    148                   148          0


Thanks



No comments:

Post a Comment