Rolling Forward a Physical Standby Database using RMAN Incremental Backup - nchillal/Oracle GitHub Wiki

Stop the managed recovery process (MRP) on the STANDBY database

sqlplus -s / as sysdba <<!
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
!

!!! Note: For the remaining steps, the standby database must be in a MOUNT state. !!!

Determine the SCN of the STANDBY database

sqlplus -s / as sysdba <<!
SELECT current_scn FROM v\$database;

SELECT 	MIN(checkpoint_change#) 
FROM 	v\$datafile_header 
WHERE 	file# NOT IN (SELECT file# FROM v\$datafile WHERE enabled = 'READ ONLY');
!

!!! Note: You need to use the 'lowest SCN' from the queries above. !!!

Take an incremental backup of the PRIMARY database

rman target / <<!
BACKUP INCREMENTAL FROM SCN 2590404855 DATABASE FORMAT '/tmp/ForStandby_%U' tag 'FORSTANDBY';
!

Transfer all backup sets to STANDBY server

scp /tmp/ForStandby_* <STANDBY_SERVER>:/tmp

Catalog the backups in STANDBY controlfile

rman target / <<!
CATALOG START WITH '/tmp/ForStandby';
!

Recover the STANDBY database with the cataloged incremental backup

rman target / <<!
RECOVER DATABASE NOREDO;
!

Connect to the PRIMARY database and create a standby control file backup

rman target / <<!
BACKUP CURRENT CONTROLFILE FOR STANDBY FORMAT '/tmp/ForStandbyCTRL.bck';
!

Copy the standby control file backup to the STANDBY system

scp /tmp/ForStandbyCTRL.bck <STANDBY_SERVER>:/tmp

Capture datafile information in STANDBY database

sqlplus -s / as sysdba <<!
spool datafile_names.txt
set linesize 200 heading off
COLUMN name FORMAT a60
SELECT file#, name FROM v$datafile ORDER BY file# ;
spool off
!

Connect to STANDBY database and restore the standby control file

rman target / 
SHUTDOWN IMMEDIATE ;
STARTUP NOMOUNT; 
RESTORE STANDBY CONTROLFILE FROM '/tmp/ForStandbyCTRL.bck'; 

Shut down the STANDBY database and startup mount

sqlplus -s / as sysdba <<!
SHUTDOWN;
STARTUP MOUNT;
!

Configure the STANDBY database to use flashback

sqlplus -s / as sysdba <<!
SELECT flashback_on FROM v$database;
ALTER DATABASE FLASHBACK ON;
!

On STANDBY database, clear all standby redo log groups

sqlplus -s / as sysdba <<!
SET HEADING OFF FEEDBACK OFF
spool /tmp/clear_srl.sql
SELECT 'ALTER DATABASE CLEAR LOGFILE GROUP '||group#||';' FROM v\$logfile WHERE type='STANDBY';
spool off
!

On the STANDBY database, start the MRP

sqlplus -s / as sysdba <<!
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
!

References

Steps to perform for Rolling Forward a Physical Standby Database using RMAN Incremental Backup. (Doc ID 836986.1)
Steps to perform for Rolling forward a standby database using RMAN incremental backup when datafile is added to primary (Doc ID 1531031.1)

⚠️ **GitHub.com Fallback** ⚠️