1.Issue the following query to find out if the standby database is performing Redo Apply or real-time apply. If the MRP0 or MRP process exists, then the standby database is applying redo.
SQL> SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY;
2.If Redo Apply is running, cancel it as shown in the following example:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
To enable real-time apply, include the USING CURRENT LOGFILE clause:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE disconnect;
SELECT DEST_ID "ID", STATUS "DB_status",DESTINATION "Archive_dest", ERROR "Error" FROM V$ARCHIVE_DEST WHERE DEST_ID =2;
SELECT INST_ID, PROCESS, CLIENT_PROCESS, STATUS, THREAD#, SEQUENCE# FROM GV$MANAGED_STANDBY;
The query indicates that Redo Apply has not applied the last 4 seconds of redo received on the standby database.
SELECT * FROM V$DATAGUARD_STATS WHERE NAME='apply lag';
Last applied Archive log numbers ==> (on DR database)
================================
select thread#, max(sequence#), applied from v$archived_log where applied='YES' group by thread#, applied;
Latest Generated logs from Primary ==>
===================================
select thread#, max(sequence#) from v$archived_log where ARCHIVED='YES' GROUP BY thread# order by thread#;
Total Archives YET to be Applied on Standby database ==>
====================================================
SELECT THREAD#, count(*) FROM V$ARCHIVED_LOG where applied='NO' group by thread# ORDER BY THREAD#;
The rate the archives are getting generated at primary database ==>
=====================================================================
select thread#, count(sequence#) "Logs Generated" from v$archived_log where
to_char (COMPLETION_TIME,'dd-Mon-yyyy') = '27-Jun-2011' group by thread# order by 1;
The rate Archive logs are applied to Standby ==>
==================================================
select thread#, count(sequence#) "Logs Applied" from v$archived_log where
to_char (COMPLETION_TIME,'dd-Mon-yyyy') = '27-Jun-2011'
and applied='YES' group by thread# order by thread#
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Archives YET to be Applied on Standby database ==>
====================================================
SELECT THREAD#, SEQUENCE#, FIRST_TIME, APPLIED
FROM V$ARCHIVED_LOG where applied='NO' ORDER BY THREAD#, FIRST_TIME;
SELECT THREAD#, count(*)
FROM V$ARCHIVED_LOG where applied='NO' group by THREAD# ORDER BY THREAD#;
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 87565 87554 11
2 96172 96162 10
3 155321 155292 29
4 72849 72826 23
Determining Which Logs Were Not Received by the Standby Site
issue the following query on the primary database:
SELECT LOCAL.THREAD#, LOCAL.SEQUENCE# FROM
(SELECT THREAD#, SEQUENCE# FROM V$ARCHIVED_LOG WHERE DEST_ID=1) LOCAL
WHERE
LOCAL.SEQUENCE# NOT IN
(SELECT SEQUENCE# FROM V$ARCHIVED_LOG WHERE DEST_ID=2 AND
THREAD# = LOCAL.THREAD#);
SQL> SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY;
2.If Redo Apply is running, cancel it as shown in the following example:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
To enable real-time apply, include the USING CURRENT LOGFILE clause:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE disconnect;
SELECT DEST_ID "ID", STATUS "DB_status",DESTINATION "Archive_dest", ERROR "Error" FROM V$ARCHIVE_DEST WHERE DEST_ID =2;
SELECT INST_ID, PROCESS, CLIENT_PROCESS, STATUS, THREAD#, SEQUENCE# FROM GV$MANAGED_STANDBY;
The query indicates that Redo Apply has not applied the last 4 seconds of redo received on the standby database.
SELECT * FROM V$DATAGUARD_STATS WHERE NAME='apply lag';
Last applied Archive log numbers ==> (on DR database)
================================
select thread#, max(sequence#), applied from v$archived_log where applied='YES' group by thread#, applied;
Latest Generated logs from Primary ==>
===================================
select thread#, max(sequence#) from v$archived_log where ARCHIVED='YES' GROUP BY thread# order by thread#;
Total Archives YET to be Applied on Standby database ==>
====================================================
SELECT THREAD#, count(*) FROM V$ARCHIVED_LOG where applied='NO' group by thread# ORDER BY THREAD#;
The rate the archives are getting generated at primary database ==>
=====================================================================
select thread#, count(sequence#) "Logs Generated" from v$archived_log where
to_char (COMPLETION_TIME,'dd-Mon-yyyy') = '27-Jun-2011' group by thread# order by 1;
The rate Archive logs are applied to Standby ==>
==================================================
select thread#, count(sequence#) "Logs Applied" from v$archived_log where
to_char (COMPLETION_TIME,'dd-Mon-yyyy') = '27-Jun-2011'
and applied='YES' group by thread# order by thread#
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Archives YET to be Applied on Standby database ==>
====================================================
SELECT THREAD#, SEQUENCE#, FIRST_TIME, APPLIED
FROM V$ARCHIVED_LOG where applied='NO' ORDER BY THREAD#, FIRST_TIME;
SELECT THREAD#, count(*)
FROM V$ARCHIVED_LOG where applied='NO' group by THREAD# ORDER BY THREAD#;
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 87565 87554 11
2 96172 96162 10
3 155321 155292 29
4 72849 72826 23
Determining Which Logs Were Not Received by the Standby Site
issue the following query on the primary database:
SELECT LOCAL.THREAD#, LOCAL.SEQUENCE# FROM
(SELECT THREAD#, SEQUENCE# FROM V$ARCHIVED_LOG WHERE DEST_ID=1) LOCAL
WHERE
LOCAL.SEQUENCE# NOT IN
(SELECT SEQUENCE# FROM V$ARCHIVED_LOG WHERE DEST_ID=2 AND
THREAD# = LOCAL.THREAD#);