How to Recover archive gaps in standby database
How to Recover archive gaps in standby database
methods
1. Manually Log Shipping (when the missing logs are very less approx
400)
METHOD 1:
When the logs missing or corrupt is less in number (say below 15), we can
ship the logs which were missing in the standby site from the primary site
(scp/sftp/ftp) and then we can register the log file in the standby so that
the gap can be resolved.
This is easy process if you have missing or corrupt logs in lesser number.
Otherwise we can use the incremental backup strategy, and perform the
recovery at standby site.
First, Find the archives which are missing by issuing the following
command. This would give the gap sequences
Or you can use the v$managed_standby view to find where the log apply
stuck.
Now, Copy the logs to the standby site from the primary site
$ scp
log_file_name_n.arc oracle@standby:/log/file/location/log_file_name_n.arc
At standby site, Do the log file registration at the standby site until all the
missing log files are registered, Use this below command.
SQL> alter database register logfile '/log/file/location/log_file_name_n.arc';
Now apply would take place and your standby will become sync with the
primary.
METHOD 2 :
when the difference is huge (say around 500 logs) the above method is
very time consuming and not a proper approach. Else you have to rebuild
the standby database from scratch.
Step 1:
Use this below command to find the SCN difference, on both the database
– Primary DB & Standby DB
Step 2 :
Step 3:
Step 4:
On the primary, take an incremental backup from the SCN number where
the standby has been stuck:
RMAN> run {
Step 5: On the primary, create a new standby controlfile and copy this file
to standby side:
SQL> alter database create standby controlfile as
'/u01/backup/for_standby.ctl';
Step 6 :
Step 7
Now, replace the previous controlfile with this new one created at
primary , and Bring the database to MOUNT state.
(Because, this Primary Side control file has the information of the SCN and
we have to perform the recovery using this controlfile)
Step 8 :
(Because , RMAN does not know about these files yet; so you must let it
know – by a process called cataloging)
$ rman target=/
Step 9 :
Step 10 :
After performing the recovery , exit RMAN and start managed recovery
process:
Step 11 :
Again Check the SCN’s in primary and standby to make sure that both are
in SYNc: