In most companies that have Oracle database running you will have a standby database that is used for HA or for reports or any other reasons.
Some times your standby database will lag behind and will get out of sync with primary database.
The error message that will be raised in your standby alert log will look something like this:
For what ever reason the sequence# 1200 was not applied, so none of the logs received later were applied. These means that our Standby database was left behind(out of sync).
Why this might happen ?
Well to get a better view of the problem that caused the standby to fall behind is to check the Primary database alert log. Sometimes the log are deleted, or there is no more space on the disk or the FRA is full.
How to fix this ?
1 - Well you can recreate the standby database but this might take some effort and resources depending on your database size, network performance, database use, etc..
2 - Another option is to apply an incremental backup of Primary starting with the SCN registered in the Standby.
We are going to go for the second option since our database is very large and standby reconstruction will take to much time.
Let's go now and see how we can do this Step by Step
1 - On Standby find the SCN value
2 - Stop the MRP process in your Standby database and shutdown the database.
MRP - Managed recovery process - For Data Guard, the background process that applies archived redo log to the standby database.
3 - Connect to the primary database as the RMAN target and create an incremental backup from the current SCN of the standby database that was recorded in step 1
4 - On the Primary, create a new standby controlfile
5 - Copy all of the backup-sets and the controlfile to the host where the Standby database is located.
6 - Replace the standby control file with the newly generated controlfile form step 4
6.1 - find the location of the actual controlfile
6.2 - Replace the controlfile with the new one(make sure your database will be shutdown while doing this)
7 - Start your standby database in mount mode
8 - Now will recover the Standby database using the incremental backup of primary taken at step 3
On the Standby server, catalog the backupset of the incremental backup taken at step 3.
9 - After the recover is done and no errors comeup we will start the Standby Managerd Recovery process
Note:
Depending on your Primary & Standby datafile location configuration you might need to rename your datafiles.
For this you can use the script bellow to rename the datafile. Make sure the replication process is stopped and your database is in mount mode.
I hope this was helpful.
Fell free leave your comments or new posts requests.