Misconception of Archive Log Sequences in Data Guard
Misconception of Archive Log Sequences in Data Guard
This behavior because of registering the old incarnation sequences with the recent control file, If you are using FRA
or try to register the archive log location when there are old incarnation sequences exist in the same location. The old
incarnation sequences can persist if we haven’t cleaned up after several Drills(Fail-over/Switchover). I did several
drills before writing this small article how the log sequences will be updated with control file. By thus you cannot
estimate or use views to check the synchronization between primary and standby database(s). So consider to
cleanup them by several procedures. We will discuss available scenarios.
Now lets check what is the maximum sequence archived on primary with the first query and second query output
shows what is the log sequence applied on standby with the GAP.
PRIMARY
SQL> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
56
SQL>
DB_NAME HOSTNAME LOG_ARCHIVED LOG_APPLIED APPLIED_TIME LOG_GAP
---------- -------------- ------------ ----------- -------------- -------
ORCL ORACLE-PRIMARY 56 48 03-FEB/19:17 8
So the maximum archived sequence on primary is “56″ and log applied on standby is “48″ from primary and the GAP
stated as “8″. Initially we start troubleshoot to fix the archive gaps of “8″ and after all the troubleshooting part found
that there is no archive with “56″ on primary and the current log sequences is just “7″ from the below output.
SQL>
Here the problem is only from the primary database and you can see from below output what is the maximum
sequence applied on the standby database.
STANDBY
SQL> select max(sequence#) from v$archived_log where applied='YES';
MAX(SEQUENCE#)
--------------
6
SQL>
So what’s wrong with the view “v$archived_log” ? Of course if you check the “RESETLOGS_CHANGE#” from the
“v$archived_log” then you can see multiple “RESETLOGS_CHANGE#” this is because of previous fail-overs the old
incarnation sequence numbers are still registered too. So how to cleanup those archives? You have several ways
– This is not always possible because you need downtime of primary/production database.
– By this procedure you can uncatalog all of the archives and after removing old incarnation archives again we can
register them as below steps.
Now gather information to verify the number of sequences after executing the package.
COUNT(*)
----------
237
SQL>
COUNT(*)
----------
no rows selected
SQL>
Register existing archive log files with Control file as below. Before this step ensure there are no archive log
sequences of old incarnation.
RMAN> catalog start with ‘Archive Log Location’;
Note:- Prior to this entire operation, Recommended to take Full backup.
After registering the archive sequences of current “RESETLOGS_CHANGE#” then you can check the sequence
numbers of primary and standby database(s) and also synchronization between primary and standby databases.
– Happy Reading–