Saturday, March 8, 2014

How to bring a Standby DB in Sync with Promary DB , if the Stand By DB was in Out of Sync

If found Standby DB(DR Server) is not in sync with Primary Database ,Follow the below steps to make it in sync with Primary DB.

1.Check the Status of log sequence with below query

SQL>select sequence#, status, process from v$managed_standby;

SEQUENCE#     STATUS       PROCESS
----------             ------------          ---------
    137675        CLOSING               ARCH
    137673        CLOSING               ARCH
    137674        CLOSING               ARCH
         0        CONNECTED             ARCH
         0                  IDLE                  RFS
    137676             IDLE                  RFS
         0                  IDLE                  RFS
    137576 WAIT_FOR_LOG        MRP0
         0                  IDLE                   RFS
2.Check the archive gap.(v$archive_gap only shows the log sequences of the next gap that needs to be resolved)

        SQL>SELECT * FROM V$ARCHIVE_GAP;

To find out how far behind your standby is (in days), try this query on the standby:

3.SQL> select name,sequence#,archived,applied from v$archived_log order by sequence#;

  
If the Gap is more like in the above example Standby DB showing 100 Archive gap with Primary DB and status is  showing "WAIT_FOR_LOG"
   

4)Check first if the archive log file which is showing "WAIT_FOR_LOG" is available in /Oracle/SID/Oraarach or not.

5)if not available try to copy mannually from primary or restore from tape
        brrestore -a 136541 -c -d util_file -r /oracle/SID/112_64/dbs/initSID.utl

 6)Once the archive log available in "oraarch" directory register the log file in Standby DB using below command:

 SQL>ALTER DATABASE REGISTER LOGFILE '/oracle/SID/oraarch/SIDarch1_136541_701090413.dbf';

  7)Then check the status again

        SQL>select sequence#, status, process from v$managed_standby;

SEQUENCE#     STATUS       PROCESS
----------             ------------          ---------
    137675        CLOSING               ARCH
    137673        CLOSING               ARCH
    137674        CLOSING               ARCH
         0        CONNECTED             ARCH
         0                  IDLE                  RFS
    137676             IDLE                  RFS
         0                  IDLE                  RFS
    137576  APPLYING LOG       MRP0
         0                  IDLE                   RFS

If the status changed to "APPLING LOG " Then the issue resolved .Now rest of the logs will applied automatically if not applying automatically then follow the above steps.

 8)Check the applied logs status

        SQL>select name,sequence#,archived,applied from v$archived_log order by sequence#;

It should show the status as applied.

 SEQUENCE# ARC APPLIED
----------            ---     ---------
/oracle/SID/oraarch/SIDarch1_137575_701090413.dbf
    137575 YES YES



No comments:

Post a Comment