Physical Standby Database Lags Far Behind the Primary Database

Physical Standby Database Lags Far Behind the Primary Database

Follow this step-by-step procedure to roll forward a physical standby database that has fallen far behind the primary database.

Note: The steps in this section can also be used to resolve problems if a physical standby database has lost or corrupted archived redo data or has an unresolveable archive gap.

  1. On the standby database, query the V$DATABASE view and record the current SCN of the standby database:
  2. SQL> SELECT CURRENT_SCN FROM V$DATABASE; CURRENT_SCN -----------      233995 
  3. Stop Redo Apply on the standby database:
  4. SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL; 
  5. Connect to the primary database as the RMAN target and create an incremental backup from the current SCN of the standby database that was recorded in step 1:
  6. RMAN> BACKUP INCREMENTAL FROM SCN 233995 DATABASE FORMAT '/tmp/ForStandby_%U' tag 'FOR STANDBY'; 

    Note:

    RMAN does not consider the incremental backup as part of a backup strategy at the source database. Hence:

    The backup is not suitable for use in a normal RECOVER DATABASE operation at the source database

    The backup is not cataloged at the source database

    The backup sets produced by this command are written to the /dbs location by default, even if the flash recovery area or some other backup destination is defined as the default for disk backups.

    You must create this incremental backup on disk for it to be useful. When you move the incremental backup to the standby database, you must catalog it at the standby as described in Oracle Database Backup and Recovery Advanced User’s Guide. Backups on tape cannot be cataloged.

  7. Transfer all backup sets created on the primary system to the standby system (note that there may be more than one backup file created):
  8. SCP /tmp/ForStandby_* standby:/tmp 
  9. Connect to the standby database as the RMAN target, and catalog all incremental backup pieces:
  10. RMAN> CATALOG START WITH '/tmp/ForStandby_'; 
  11. Connect to the standby database as the RMAN target and apply incremental backups
  12. RMAN> RECOVER DATABASE NOREDO; 
  13. Remove the incremental backups from the standby system:
  14. RMAN> DELETE BACKUP TAG 'FOR STANDBY'; 
  15. Manually remove the incremental backups from the primary system:
  16. rm /tmp/ForStandby_* 
  17. Start Redo Apply on the physical standby database:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;