# Preparing the library to view the gap
SQL> select * from v$archive_gap ;
THREAD# LOW_SEQUENCE# HIGH_SEQUENCE# CON_ID
---------- ------------- -------------- ----------
1 20 40 1
# Cancel the application log
SQL> alter database recover managed standby database cancel;
Database altered.
# Find the scann corresponding to low_sequence#-1 in the v$archived_log in the main library (i.e. first_change#)
SQL> select thread#, sequence#, first_change#, next_change# from v$archived_log where sequence# = 19;
THREAD# SEQUENCE# FIRST_CHANGE# NEXT_CHANGE#
---------- ---------- ------------- ------------
1 19 2897221 2920514
1 19 2897221 2920514
# The main library rman makes incremental backup based on this scn
[oracle@cct2 ~]$ mkdir -p /u01/rman_bak
[oracle@cct2 ~]$ rman target /
RMAN> run {
2> allocate channel c1 device type disk;
3> allocate channel c2 device type disk;
4> backup incremental from scn 2897221 database format '/u01/rman_bak/cctde_scn_%';
5> release channel c1;
6> release channel c2;
7> }
# The main library rman creates a new backup library control file
rman target /
RMAN> backup current controlfile for standby format '/u01/rman_bak/std_ctl.bak';
# Copy the backup file to the backup library
[oracle@cct2 ~]$ scp -r /u01/rman_bak/ 192.168.56.11:/u01/
# Preparing the library shutdown and starting the backup library to the nomount state
SQL> shutdown immedidate;
SQL> startup nomount;
# Restore the control file to the original control file path of the backup library and start to mount state
[oracle@cct1 CCTDEDG]$ rman target /
RMAN> restore standby controlfile from '/u01/rman_bak/std_ctl.bak';
RMAN> alter database mount;
# Backup library rman registers backup set and restores the database
[oracle@cct1 CCTDEDG]$ rman target /
RMAN> catalog start with '/u01/rman_bak/';
RMAN> recover database;
RMAN> alter database open;
# Check whether the gap still exists
SQL> select * from v$archive_gap ;
no rows selected
# Master library checks whether the SCNs of master-slave synchronization tend to be consistent
SQL> select 1 dest_id, current_scn from v$database
union all
select dest_id, applied_scn from v$archive_dest where target='STANDBY'; 2 3
DEST_ID CURRENT_SCN
---------- -----------
1 3107287
2 3107267