Role Forward Physical Standby Using service method

 Oracle Physical standby sometimes can go out of sync and it may not be possible to get the archive logs due to the size and amount of time. In these cases earlier we need to either rebuild the standby or take the incremental backup from primary database and recover the standby.

With 12c in place oracle introduced one more method commonly known as recover form service as well which makes this process simple and straightforward.

Using service method does following

1. It takes the incremental backup from the SCN of the standby datafile and transfer that backup to DR site over the network (earlier this method use to be done manually).

2. Applies the incremental backup to physical standby.


Lets discuss the steps now in detail:


Step1: Start the standby database is mount state.

    srvctl stop database -d <db unique name>

    srvctl start database -d <db unique name> -o mount


Step2: Stop the standby database recovery

    alter database recover managed standby database cancel;


Step3: Identify the scn on primary and standby database and keep that in records to be used later.

    select HXFIL File_num, substr(HXFNM,1,40), fhscn from x$kcvfh;

Above needs to be checked on both primary and standby and will give you scn of each datafile which will tell what all datafiles on standby is lagging behind primary scn and need recovery.

Also gather the current_scn on standby

    select to_char(current_scn) from v$database;


Step4: Now the main step comes which recovers your standby using service method

    rman> recover database from service <primary service name> noredo using compressed backupset;

This step would take time based on recovery your standby needs.


Step5: Since we have done the datafile recovery and our control file would be still having old scn, it's time to restore the controlfile as well.

This would also need some additional steps as your datafile naming could be different names due to various reasons.

    shutdown immediate

    startup nomount

    rman> restore standby controlfile from service <primary service name>;

    rman> alter database mount;

    rman> report schema;

Now if your datafiles, tempfiles lies in different location on standby following below steps else skip to next one

    rman> catalog start with '/datafile location/';

    rman> switch database to copy;


Step6: Now there would be cases where some new datafiles would be added on primary site during the time your standby was out of sync. 

In order to identify we need to use current_scn value from standby and run query on primary

    select file# from v$datafile where creation_change# = <current_scn value>;

In case of no files reported we are good to skip next steps else follow along

Identify the datafiles which are newly created and restore them on standby

    rman> run{

                        set newname for database to '/';

                        restore datafile <datafile number> from service <primary service name>;

                    }

Repeat above steps for all the datafiles which was created later on primary site and needed to be restore on standby.


Step7: Next step would be to update the names of standby redo log files

    alter database clear logfile group <group_number>;


Step8: Standby the standby recovery

        alter database recover managed standby database using current logfile disconnect;


Step9: Perform some switches on primary site and make sure everything is in sync

       alter system archive log current;


For more details refer to Oracle Support Metalink Doc Id: 1987763.1

Comments

Popular posts from this blog

How to Solve - "WAIT FOR EMON PROCESS NTFNS"

Query Regression - "OR" Transformation Oracle 19c

ORA - 12537: TNS: connection closed