How to check archivelog gap?
-- On STANDBY, open_mode should be set to MOUNTED at least:
SELECT log_mode, open_mode, database_role from v$database;
-- On STANDBY, MRP0 process should show "Applying_log":
SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY;
select process, client_process, sequence#, status from V$managed_standby;
-- On STANDBY, determine if there are any archived log gaps
-- Query should return no rows:
Select * From v$archive_gap;
-- On STANDBY, compare last applied log file against last received archived log
-- Difference should not be greater than 2.
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;
set echo off
conn / as sysdba
set echo on
-- On PRIMARY, list the sequence#s of the logs that were last archived.
-- These should match "Last seq received" from previous query:
select thread#, max(sequence#) from v$archived_log group by thread#;
-- On PRIMARY, find out which logs where not shipped to standby.
-- The query should return no rows:
Select thread#,sequence#
From v$archived_log a
where dest_id=1
and a.sequence# >
(select min(b.sequence#)-1 from v$archived_log b
where b.dest_id=2
and b.thread#=a.thread#)
Minus
Select c.thread#,c.sequence#
From v$archived_log c where c.dest_id=2;
-- On STANDBY, open_mode should be set to MOUNTED at least:
SELECT log_mode, open_mode, database_role from v$database;
-- On STANDBY, MRP0 process should show "Applying_log":
SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY;
select process, client_process, sequence#, status from V$managed_standby;
-- On STANDBY, determine if there are any archived log gaps
-- Query should return no rows:
Select * From v$archive_gap;
-- On STANDBY, compare last applied log file against last received archived log
-- Difference should not be greater than 2.
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;
set echo off
conn / as sysdba
set echo on
-- On PRIMARY, list the sequence#s of the logs that were last archived.
-- These should match "Last seq received" from previous query:
select thread#, max(sequence#) from v$archived_log group by thread#;
-- On PRIMARY, find out which logs where not shipped to standby.
-- The query should return no rows:
Select thread#,sequence#
From v$archived_log a
where dest_id=1
and a.sequence# >
(select min(b.sequence#)-1 from v$archived_log b
where b.dest_id=2
and b.thread#=a.thread#)
Minus
Select c.thread#,c.sequence#
From v$archived_log c where c.dest_id=2;
DR SYNC STEPS;;;
1. Restore/Copy the archives to the location on standby
If archive logs are in ASM copy to file system and then to standby
RMAN> copy archivelog '+FLASH_DG/PRD/ARCHIVELOG/2012_09_02/thread_3_seq_93970.9317.792907937' to '/u01/rman01/prd/incbkp/thread_3_seq_93970.9317.792907937';
2.Register the archives with the database(alter database register logfile '/u01/rman01/prd/incbkp/thread_3_seq_93970.9317.792907937';)
3.alter database recover managed standby database disconnect;----will apply archives
4.select max(sequence#) from v$archived_log where applied='YES';(the count should be increasing)
No comments:
Post a Comment