How to deal with gap in Dataguard archive

Source: Internet
Author: User

Gap is created by the fact that the archive log between the repository and the main repository may be inconsistent due to network and other reasons between the Dataguard master and standby.
Steps to resolve gap:
1. Get gap details in the standby library
2. Copy the required archive logs from the main library to the standby library
3. The Standby library registers the archive log and then applies it.

--Standby Alert log hint gap details
Media Recovery waiting for thread 1 sequence 7057
Fetching gap sequence in thread 1, Gap sequence 7057-7080
Fal[client]: Error fetching gap sequence, no FAL server specified
Mon Mar 11:39:40 CST 2014
Fal[client]: Failed to request gap sequence
Gap-thread 1 Sequence 7057-7080
DBID 768411208 Branch 784810891
Fal[client]: All defined FAL servers has been attempted.

--You can also check gap in the standby library
SELECT * from V$archive_gap;

--For convenience, assemble copy statements
--If the archive log is in ASM, the archive log is first copied to the OS via Rman and then SCP to the standby standby archive directory;
--If the archive log is on the OS, direct SCP to the standby Repository standby archive directory.
@Pirmary
Select Length (' +dg1/primary/archivelog/2014_03_21/') from dual;
LENGTH (' +dg1/primary/archivelog/2014_03_21/')
---------------------------------------------
35

--get Copy command
Select ' Copy archivelog ' | | name| | ' to '/tmp/' | | substr (name,35) | | ";"
From V$archived_log
where sequence#>7060
and sequence#<=7080
and Thread#=1
and name<> ' standby service NAME ';

--copy Archive logs from ASM to OS
Rman Target/
Copy Archivelog ' +dg1/primary/archivelog/2014_03_21/thread_1_seq_7061.393.842805877 ' to '/tmp/thread_1_seq_ 7061.393.842805877 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_21/thread_1_seq_7062.472.842816319 ' to '/tmp/thread_1_seq_ 7062.472.842816319 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_21/thread_1_seq_7063.414.842825435 ' to '/tmp/thread_1_seq_ 7063.414.842825435 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_22/thread_1_seq_7064.308.842843087 ' to '/tmp/thread_1_seq_ 7064.308.842843087 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_22/thread_1_seq_7065.278.842847011 ' to '/tmp/thread_1_seq_ 7065.278.842847011 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_22/thread_1_seq_7066.415.842847023 ' to '/tmp/thread_1_seq_ 7066.415.842847023 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_22/thread_1_seq_7067.469.842850077 ' to '/tmp/thread_1_seq_ 7067.469.842850077 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_22/thread_1_seq_7068.402.842864915 ' to '/tmp/thread_1_seq_ 7068.402.842864915 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_22/thread_1_seq_7069.475.842868603 ' to '/tmp/thread_1_seq_ 7069.475.842868603 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_22/thread_1_seq_7070.413.842869761 ' to '/tmp/thread_1_seq_ 7070.413.842869761 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_22/thread_1_seq_7071.312.842871319 ' to '/tmp/thread_1_seq_ 7071.312.842871319 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_22/thread_1_seq_7072.407.842874331 ' to '/tmp/thread_1_seq_ 7072.407.842874331 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_22/thread_1_seq_7073.405.842874917 ' to '/tmp/thread_1_seq_ 7073.405.842874917 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_22/thread_1_seq_7074.328.842875663 ' to '/tmp/thread_1_seq_ 7074.328.842875663 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_22/thread_1_seq_7075.296.842876043 ' to '/tmp/thread_1_seq_ 7075.296.842876043 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_22/thread_1_seq_7076.452.842886921 ' to '/tmp/thread_1_seq_ 7076.452.842886921 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_22/thread_1_seq_7077.446.842906131 ' to '/tmp/thread_1_seq_ 7077.446.842906131 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_23/thread_1_seq_7078.348.842928271 ' to '/tmp/thread_1_seq_ 7078.348.842928271 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_23/thread_1_seq_7079.347.842928277 ' to '/tmp/thread_1_seq_ 7079.347.842928277 ';
Copy Archivelog ' +dg1/primary/archivelog/2014_03_23/thread_1_seq_7080.367.842929387 ' to '/tmp/thread_1_seq_ 7080.367.842929387 ';


--send Archive logs to standby
SCP thread_1_seq_70* 10.1.1.10:/tmp

--get Standby Register Archivelog command
--Also in the main library execution, get registration statement
Select ' ALTER DATABASE REGISTER physical LOGFILE '/tmp/' | | substr (name,35) | | ";" from V$archived_log where sequence#>7060 and sequence#<=7080 and Thread#=1 and name<> ‘Standby service name ';

ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7061.393.842805877 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7062.472.842816319 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7063.414.842825435 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7064.308.842843087 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7065.278.842847011 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7066.415.842847023 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7067.469.842850077 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7068.402.842864915 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7069.475.842868603 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7070.413.842869761 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7071.312.842871319 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7072.407.842874331 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7073.405.842874917 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7074.328.842875663 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7075.296.842876043 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7076.452.842886921 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7077.446.842906131 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7078.348.842928271 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7079.347.842928277 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7080.367.842929387 ';



@Standby
--register Gap Archivelog to standby
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7061.393.842805877 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7062.472.842816319 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7063.414.842825435 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7064.308.842843087 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7065.278.842847011 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7066.415.842847023 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7067.469.842850077 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7068.402.842864915 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7069.475.842868603 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7070.413.842869761 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7071.312.842871319 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7072.407.842874331 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7073.405.842874917 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7074.328.842875663 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7075.296.842876043 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7076.452.842886921 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7077.446.842906131 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7078.348.842928271 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7079.347.842928277 ';
ALTER DATABASE REGISTER physical LOGFILE '/tmp/thread_1_seq_7080.367.842929387 ';

--if Standby is real apply,then standby would AUTO apply Archivelog
--if Not,please Open Real apply
ALTER database RECOVER MANAGED STANDBY database USING current LOGFILE DISCONNECT from SESSION;

--get Real Apply Info
Set Linesize 200
Col name for A70
Alter session set nls_date_format= ' Yyyy-mm-dd hh24:mi:ss ';
Select Name,thread#,first_time,sequence#,applied from V$archived_log order by first_time,thread#,sequence#,dest_id;

--you can see alert log, it also show archivelog apply info
Tail-f Alert.log

--make sure no gap between Primary and Standby
sql> select * from V$archive_gap;

--clean
Span style= "font-family: ' Courier New '; Color: #000000; " > @Priamry
cd/tmp
rm thread_*

rman> crosscheck Archivelog All;
rman> list archivelog all;
rman> Delete expired archivelog all;
 
http://blog.chinaunix.net/ uid-23284114-id-4190413.html

Dataguard of the gap in the primary and standby archive

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.