Archive Log Gaps

Here is some code to help identify what has been applied and what is missing.

Archivelog gap

set pagesize 300
set linesize 220
set wrap off
select thread#, sequence#, applied,
to_char(first_time,'mm/dd/yy hh24:mi:ss') first,
to_char(next_time, 'mm/dd/yy hh24:mi:ss') next,
to_char(completion_time, 'mm/dd/yy hh24:mi:ss') completion
from v$archived_log where thread# = 1 order by first_time;

Log Gap Check

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;

Get Archive Logs from Backup

Archive gap restore
 run {
 allocate channel t1 type 'sbt_tape';
 SEND 'NB_ORA_CLIENT=backup-bkup,NB_ORA_SERV=tape-bkup';
 restore archivelog from sequence 348627 until sequence 348726 thread 1;
 }

Stop and Start Apply Services

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.