How to Re-sync the standby database with primary database using an RMAN incremental backup from the primary database.

Scenario:

One of the archivelog files is missing and there is no backup of that archivelog. Primary database and Standby database are not in SYNC. There is an archival gap.

Resyncing the standby data using RMAN incremental backup taken from the primary database.
PRIMARY DATABASE  –> DBA12
STANDBY DATABASE –> DBA13

Step 1 :
we need to check that the data has been replicated to the standby database from the primary database.

At Primary side :

At Standby side :

Step 2 :
Now cancel the media recovery (MRM) in Standby database.

At Standby side :

Step 3 :
Do some transaction on any user commit and Now connect as a sys user and switch the log file.

At Primary side :

 

Step 4 :

Now remove last archivelog file physically from the production database and standby server also.
The archivelog file with sequence# 266 will be moved to standby database. Since the media recovery process has been canceled the archivelog will not be applied to the standby database.

Once after deleting the archivelog file from both production and standby database servers, enable the media recovery process in standby database.

At Primary side :

At Standby side :

Step 6 :

Archivelog with sequence# 266 is missing from primary and also from standby database. Due to this there is an archival gap between primary database and standby database. The synchronization between primary database and standby database has been lost.

We have to recover / resync the standby database with the primary database.

The steps to resync the standby database using an incremental RMAN backup from the primary database are as follows.

–> Get the current scn of the standby database.,

At Standby side :

Step 7 :
Connect to the primary database as the RMAN target and create an incremental backup from the current SCN (for a standby lagging far behind the primary):

At Primary side :

Step 8 :

At Primary side :

Create a standby controlfile on the primary .

Step 9 :
Shutdown the standby database and recreate the standby controlfile on the standby.
Mount the standby database.
  • At Standby side :

Step 10 :
Catalog backup pieces if the location on the standby is different from the primary.

At Standby side :

 

 

Step 12 :
Start the media recovery process in standby database.

At Standby side :

 

At Primary side :

 

At Standby side :

 

From the above Archivelog sequence# numbers , we can clearly see that both primary and standby databases are in sync.

Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (6 votes, average: 4.83 out of 5)
Loading...

One thought on “How to Re-sync the standby database with primary database using an RMAN incremental backup from the primary database.

Add Comment