How to Sync the Physical Standby Gaps Using RECOVER FROM SERVICE in Oracle



Oracle Introduced new commands RECOVER FROM SERVICE for make the database sync if dataguard out of sync by reducing the steps.


Command “RECOVER … FROM SERVICE” below steps done automatically

1. Creating the incremental back of RMAN from Primary site of the SCN at standby DB.
2. Transfer the incremental backup at Standby
3. Apply the incremental backup at standby to make them sync.

This will help incase even if the archives are deleted on the primary database as well. 

Steps:

1. Identify the gap between both Primary and Standby Site:

Run the following command on both primary and standby DB to identified the out of sync.

-- On Standby and primary both
-- Check SCN difference of DB
SELECT CURRENT_SCN FROM V$DATABASE;

--Check SCN difference of Files
select HXFIL File_num,substr(HXFNM,1,40),fhscn from x$kcvfh;



2) On Standby DB:

Stop the replication service MRP on Standby Database:

-- On Standby
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;


 Shutdown the database and open in mount state:

-- On Standby
Shutdown immediate
Startup mount



3) Connect with the Standby Server through RMAN


Roll forward the physical standby database using the RECOVER STANDBY DATABASE command with the FROM SERVICE clause.

rman target sys/syspassword@standby_service


The FROM SERVICE clause specifies the service name of the primary database using which the physical standby must be rolled forward. The standby database is restarted after the roll forward operation.

RECOVER STANDBY DATABASE FROM SERVICE primary_db;


4) After completion, check the SCN for the files for both production and Standby Server:

-- On Both Primary and Standby
--Check SCN difference of Files, it should be equal.
select HXFIL File_num,substr(HXFNM,1,40),fhscn from x$kcvfh;
5) Start the managed recovery processes on the physical standby database.


ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;






If you like please follow and comment