Wednesday, July 26, 2017

Physical Standby database re-build with incremental backup approach

Issue :

Physical standby database was out of sync with production either by missing archive logs in primary database or with some other reason. We need catch up the standby with primary database. We can restart the MRP process which will eventually apply all the archives but if archives gap is huge or archives was not available because of retention policy, you may not process with MRP process.
We can use Incremental backup approach for this kind of situation, which is less time consuming activity comparing with MRP process. Below are the steps to perform.


Steps:


On Standby:

– check current scn# of standby

SBY>select to_char(current_scn) from v$database;

CURRENT_SCN
-----------
XXXXXXXX

On Primary:

– Create a standby control file:
ALTER DATABASE CREATE STANDBY CONTROLFILE AS '<backup-location>/standby_control.ctl';

– Take incremental backup on primary starting from scn# of standby database
RMAN uses the selected SCN as the basis for this incremental backup. For all files being backed up, RMAN includes all data blocks that were changed at SCNs greater than or equal to the FROM SCN in the incremental backup.
Note:
• RMAN does not consider the incremental backup as part of a backup strategy at the source database. The backup is not suitable for use in a normal RECOVER DATABASE operation at the source database.

run
{
Backup AS compressed backupset incremental from SCN XXXXXXXX database tag='FOR_STANDBY' format '<backup-location>/%d_%t_%s_%p';
}

***********Once backup is done start working from below*************

– copy the standby control file to standby host

- Copy the backup files to standby site

On Standby:

– Find out names of current control files
col value for a50
col name for a15
select name, value   from v$parameter where upper(name)= 'CONTROL_FILES';

- Shutdown the standby database and rename the original control file of the standby database:
 Shutdown immediate;

- Backup all the control files

– Restore the standby control file just copied from the primary


– Startup the Standby database with the new controlfile:

SQL> startup mount;

RMAN> restore controlfile from '<controlfile_location>';

– Catalog the Incremental Backup Files at the Standby Database
RMAN>  catalog start with   '<Location>';

– Apply the Incremental Backup to the Standby Database
Use the RMAN RECOVER command with the NOREDO option to apply the incremental backup to the standby database. All changed blocks captured in the incremental backup are updated at the standby database, bringing it up to date with the primary database.

SBY> recover managed standby database cancel;


RMAN> RECOVER DATABASE from tag <backup_tab_name> NOREDO;

Start the Managed Recovery process on the standby DB:
SBY>recover managed standby database disconnect from session;


You can now resume managed recovery at the standby. Any redo logs required at the standby with changes since those contained in the incremental are automatically requested from the primary and applied.

— check that SCN# of the standby database has advanced.

SBY>select current_scn from v$database;


No comments:

Post a Comment

RMAN-06457

Issue : Rman active duplicate failed with below error. RMAN-00571: =========================================================== RMAN-...