Wednesday, April 10, 2013

DR Sync or not

To check the DR Sync or not
**********************************************************************************************************************************************************************************************************************************************************
**********************************************************************************************************************************************************************************************************************************************************
login to primary db
run this query
select thread#, max(sequence#) from v$archived_log group by thread#;
select thread#, max(sequence#) from v$archived_log where applied='YES' group by thread#;
first one shows primary db last generated sequence
second one will give what is the last log applied in standby
if both are equal dr is sync
if no
we need to login to DR and check what is the issue
Exec below query at Physcial standby by(I am asuming it to be so)...
SELECT PROCESS, CLIENT_PROCESS, SEQUENCE#, STATUS FROM V$MANAGED_STANDBY;
If your DR is a Physical Standby, then check if ARCH, MRP0,RFS processes are running.
If any of the process is not running, either shipping or applying of log files will not happen.
Also check the archive Dest of Stdby. In case log files are available, but not gettting applied, you need to register them manually.


SQL> SELECT PROCESS, CLIENT_PROCESS, SEQUENCE#, STATUS FROM V$MANAGED_STANDBY;
PROCESS CLIENT_P SEQUENCE# STATUS
--------- -------- ---------- ------------
ARCH ARCH 0 CONNECTED
ARCH ARCH 0 CONNECTED
ARCH ARCH 0 CONNECTED
ARCH ARCH 0 CONNECTED
ARCH ARCH 0 CONNECTED
RFS N/A 0 IDLE
MRP0 N/A 9999 WAIT_FOR_GAP


select switchover_status from v$database;


The SWITCHOVER_STATUS should have the value of TO STANDBY or SESSIONS ACTIVE. If not then redo transport is not functioning properly and you will not be able to perform the switchover.
If you received SESSIONS ACTIVE in the prior step you might have connections that may prevent the switchover. Verify the active connections by querying V$SESSION.