Sunday, December 4, 2022

Recover standby database with Archive Log backup

Step 01

Cancel the MRP process and run the query below with sqlplus to find the required sequence.

SQL > alter database recover managed standby database cancel;

Check the archivelog required to recover the standby DB.

SQL> alter database recover standby database;

============

alter database recover standby database

*

ERROR at line 1:

ORA-00279: change 76791978408 generated at 12/01/2022 08:13:07 needed for

thread 1

ORA-00289: suggestion : +RECOC1

ORA-00280: change 76791978408 for thread 1 is in sequence #432918

 SQL>

==================

Step 02.

 In this scenario, thread 1 sequence 432918 is required to recover.

Check the max sequence generated on Primary database.

SQL> select max(SEQUENCE#),thread# from v$archived_log group by thread#;

Run the RMAN command below to take the backup accordingly.

RMAN > BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG FROM SEQUENCE 432918 UNTIL SEQUENCE 433570 THREAD 1 format '/mnt/nfs/Ora_back/RMAN/DBM01/%U';

 

Step 03.

Copy the Backup files to the Standby database server.

Step 04.

Catalog the backup files.

RMAN> catalog start with '/acfs01/Ora_back/RMAN/DBM01/Arc_T1';

Step 05.

Recover the database.

RMAN> recover database;

 --- Got below error as I've to take a thread 2 backup as well because this is a RAC Database.

RMAN-06054: media recovery requesting unknown archived log for thread 2 with sequence 545051 and starting SCN of 7679200924

------

 

Step 06.

 

Take the backup of thread 2.

 

RMAN > BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG FROM SEQUENCE 545051 UNTIL SEQUENCE 545510 THREAD 2 format '/mnt/nfs/Ora_back/RMAN/DBM01/%U';

 

Step 07.

 Copy the Files and Catalog again as thread 1.

 Step 08.

 RMAN> recover database;

 

SQL > alter database recover managed standby database disconnect from session;