{"id":396,"date":"2021-02-25T10:58:25","date_gmt":"2021-02-25T00:58:25","guid":{"rendered":"http:\/\/www.mrmarkyoung.com\/oracle\/?p=396"},"modified":"2021-02-25T11:02:20","modified_gmt":"2021-02-25T01:02:20","slug":"archive-log-gaps","status":"publish","type":"post","link":"http:\/\/www.mrmarkyoung.com\/oracle\/2021\/02\/25\/archive-log-gaps\/","title":{"rendered":"Archive Log Gaps"},"content":{"rendered":"\n<p>Here is some code to help identify what has been applied and what is missing.<\/p>\n\n\n\n<p><strong>Archivelog gap<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set pagesize 300\nset linesize 220\nset wrap off\nselect thread#, sequence#, applied,\nto_char(first_time,'mm\/dd\/yy hh24:mi:ss') first,\nto_char(next_time, 'mm\/dd\/yy hh24:mi:ss') next,\nto_char(completion_time, 'mm\/dd\/yy hh24:mi:ss') completion\nfrom v$archived_log where thread# = 1 order by first_time;\n<\/code><\/pre>\n\n\n\n<p>Log Gap Check<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT ARCH.THREAD# \"Thread\",\n         ARCH.SEQUENCE# \"Last Sequence Received\",\n         APPL.SEQUENCE# \"Last Sequence Applied\",\n         (ARCH.SEQUENCE# - APPL.SEQUENCE#) \"Difference\"\n    FROM (SELECT THREAD#, SEQUENCE#\n            FROM V$ARCHIVED_LOG\n           WHERE (THREAD#, FIRST_TIME) IN (  SELECT THREAD#, MAX (FIRST_TIME)\n                                               FROM V$ARCHIVED_LOG\n                                           GROUP BY THREAD#)) ARCH,\n         (SELECT THREAD#, SEQUENCE#\n            FROM V$LOG_HISTORY\n           WHERE (THREAD#, FIRST_TIME) IN (  SELECT THREAD#, MAX (FIRST_TIME)\n                                               FROM V$LOG_HISTORY\n                                           GROUP BY THREAD#)) APPL\n   WHERE ARCH.THREAD# = APPL.THREAD#\nORDER BY 1;<\/code><\/pre>\n\n\n\n<p><strong>Get Archive Logs from Backup<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Archive gap restore\r\n run {\r\n allocate channel t1 type 'sbt_tape';\r\n SEND 'NB_ORA_CLIENT=backup-bkup,NB_ORA_SERV=tape-bkup';\r\n restore archivelog from sequence 348627 until sequence 348726 thread 1;\r\n }<\/code><\/pre>\n\n\n\n<p>Stop and Start Apply Services<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;\r\nALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Here is some code to help identify what has been applied and what is missing. Archivelog gap Log Gap Check Get Archive Logs from Backup Stop and Start Apply Services<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[],"class_list":["post-396","post","type-post","status-publish","format-standard","hentry","category-oracle-database","category-oracle-rman"],"_links":{"self":[{"href":"http:\/\/www.mrmarkyoung.com\/oracle\/wp-json\/wp\/v2\/posts\/396","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.mrmarkyoung.com\/oracle\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.mrmarkyoung.com\/oracle\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.mrmarkyoung.com\/oracle\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.mrmarkyoung.com\/oracle\/wp-json\/wp\/v2\/comments?post=396"}],"version-history":[{"count":3,"href":"http:\/\/www.mrmarkyoung.com\/oracle\/wp-json\/wp\/v2\/posts\/396\/revisions"}],"predecessor-version":[{"id":399,"href":"http:\/\/www.mrmarkyoung.com\/oracle\/wp-json\/wp\/v2\/posts\/396\/revisions\/399"}],"wp:attachment":[{"href":"http:\/\/www.mrmarkyoung.com\/oracle\/wp-json\/wp\/v2\/media?parent=396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.mrmarkyoung.com\/oracle\/wp-json\/wp\/v2\/categories?post=396"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.mrmarkyoung.com\/oracle\/wp-json\/wp\/v2\/tags?post=396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}