-- To stop the redo log apply synch for some time in Oracle Active Dataguard ( stand-alone)
-- OS/Database: Linux 6.3 - 64bit, Oracle 11.2.3.0.0
-- Scenario Test : Production
-- Applicable: Any Platform of Database Oracle 11.2.x.x.x
-- Check whether in synch or not ( collect last sequence# from primary side)
SQL> select max(sequence#) from v$archived_log where applied='YES';
MAX(SEQUENCE#)
--------------
6712
-- Stop the synch
SQL> alter database recover managed standby database cancel;
Database altered.
-- Verify synch is stopped. ( manyally create some archive log)
SQL> select max(sequence#) from v$archived_log where applied='YES';
MAX(SEQUENCE#)
--------------
6712
-- Query to verify ( assume synch stopped for 5 hrs )
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;
output:
Thread Last Sequence Received Last Sequence Applied Difference
---------- -------------------- -------------------------------- ------------------------
1 6775 6730 45
-- Start synch again
SQL> alter database recover managed standby database disconnect from session;
Database altered.
-- Keep on checking archivelogs are started applying
SQL> select max(sequence#) from v$archived_log where applied='YES';
Thanks
Hope queries will help you.
-- OS/Database: Linux 6.3 - 64bit, Oracle 11.2.3.0.0
-- Scenario Test : Production
-- Applicable: Any Platform of Database Oracle 11.2.x.x.x
-- Check whether in synch or not ( collect last sequence# from primary side)
SQL> select max(sequence#) from v$archived_log where applied='YES';
MAX(SEQUENCE#)
--------------
6712
-- Stop the synch
SQL> alter database recover managed standby database cancel;
Database altered.
-- Verify synch is stopped. ( manyally create some archive log)
SQL> select max(sequence#) from v$archived_log where applied='YES';
MAX(SEQUENCE#)
--------------
6712
-- Query to verify ( assume synch stopped for 5 hrs )
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;
output:
Thread Last Sequence Received Last Sequence Applied Difference
---------- -------------------- -------------------------------- ------------------------
1 6775 6730 45
-- Start synch again
SQL> alter database recover managed standby database disconnect from session;
Database altered.
-- Keep on checking archivelogs are started applying
SQL> select max(sequence#) from v$archived_log where applied='YES';
Thanks
Hope queries will help you.
No comments:
Post a Comment