Rolling Forward a Physical Standby Database Made Easy with RMAN

Maintaining a physical standby database in sync with the primary is a critical part of Oracle Data Guard administration. Traditionally, rolling forward a standby using incremental backups from the primary required multiple manual steps, which were both time-consuming and error-prone. Fortunately, Oracle has introduced powerful RMAN enhancements that simplify this process significantly.

The Traditional Approach (Before 12c)

Earlier, refreshing a standby involved:

  • Identify the Start SCN on standby for incremental backup
  • Perform incremental backup on primary with FROM SCN clause
  • Move backup pieces from primary to standby
  • Catalog backup pieces on standby
  • Recover standby using RECOVER DATABASE NOREDO
  • Refresh standby controlfile again from primary

This workflow was manual, error-prone, and especially tricky when file paths differed between primary and standby.

Oracle 12c Improvement

Starting with Oracle 12.1, RMAN introduced:

RECOVER DATABASE FROM SERVICE <primary_connect_identifier/TNS alias>;

This command automated several steps:

  • Performing incremental backup on primary
  • Transferring backup pieces over the network
  • Applying recovery on standby

However, DBAs still had to manually refresh the standby controlfile and restore newly added datafiles.

Oracle 18c Breakthrough

With Oracle 18.1, things got much simpler. A single command now handles the entire refresh:

RMAN>
RECOVER STANDBY DATABASE FROM SERVICE primary_connect_identifier;

This command:

  • Tracks standby file locations
  • Refreshes the standby controlfile from primary
  • Updates file names in the controlfile
  • Performs incremental backup on primary
  • Transfers backup pieces over the network
  • Applies recovery on standby

Step-by-Step Solution

  • Stop managed recovery on standby:
SQL> RECOVER MANAGED STANDBY DATABASE CANCEL;
If using Data Guard Broker:

DGMGRL> EDIT DATABASE '<standby_db>' SET STATE='APPLY-OFF';
  • Handle RAC environments:
Ensure only one instance is mounted; shut down others to avoid RMAN-05157.

  • Check Oracle Net connectivity:
Add primary DB entry in tnsnames.ora on standby.

  • Run RMAN command:

$ export ORACLE_SID=STBY
$ rman target /
RMAN> RECOVER STANDBY DATABASE FROM SERVICE PROD;

  • Clear redo logs after recovery:
BEGIN
  FOR log_cur IN (SELECT group# FROM v$log) LOOP
    EXECUTE IMMEDIATE 'ALTER DATABASE CLEAR LOGFILE GROUP '||log_cur.group#;
  END LOOP;
END;
/
Repeat for standby redo logs:

BEGIN
  FOR log_cur IN (SELECT group# FROM v$standby_log) LOOP
    EXECUTE IMMEDIATE 'ALTER DATABASE CLEAR LOGFILE GROUP '||log_cur.group#;
  END LOOP;
END;
/


 Notes & Tips

  • If you encounter SBT channel errors, configure defaults on primary:
    RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK;
    RMAN> CONFIGURE CHANNEL DEVICE TYPE SBT CLEAR;
    
  • If disk channels use CONNECT clause, clear them on primary:
    RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK CLEAR;
Revert back after the standby is in sync

Conclusion

With Oracle 18c and later, refreshing a physical standby database is no longer a tedious, error-prone process. The RECOVER STANDBY DATABASE FROM SERVICE command automates controlfile refresh, incremental backup, transfer, and recovery—all in one go. This enhancement saves DBAs time, reduces complexity, and improves reliability in Data Guard environments.









Please do like and subscribe to my youtube channel: https://www.youtube.com/@foalabs If you like this post please follow,share and comment