Recovery of One Oracle Standby Database from Second Standby through Incremental backup and Error code: ORA-38868


Step 1. Check Current SCN of Second Standby Server which is to be updated.

Standby 2
================================
sql>select TO_CHAR(current_scn) from v$database;

10446109969

Now Stop the Replication Process.

SQL>Alter database recover managed standby database cancel;


Step 2. Stop the Replication Process on First Standby Server Which is updated and take Incremental Backup using SCN.

Standby 1
================================
SQL> select database_role, open_mode, name from v$database;

SQL> alter database recover managed standby database cancel;

SQL> alter database open read only;

RMAN Target /

RMAN> Backup incremental  from scn 896667980266 database format "f:/inc_bkp_test/stnd_backup_%U.back";

Rman> backup current controlfile for standby format “f:/std_ctl.ctl”;

or Create a new standby control file

alter database create standby controlfile as ‘f:/stby.ctl’;

SQL>shutdown immediate;
SQL>Startup nomount
SQL>alter database mount standby database
SQL>alter database recover managed standby database disconnect from session;

Step 3. Transfer the backup from Standby 1 to Standby 2

Standby 2
================================
Note - If control backup was not taken successfully and it was created from standby server1 [shutdown standby 2 and replace control files]
================================

Step 4. Recover The database on Second Standby Server using latest SCN based bakup

RMAN> catalog start with “m:/inc-bkp-test/”;

RMAN> recover database noredo;

Step 5. Shutdown the Standby 2 database, start in nomount stage and restore the standby control file backup

RMAN>  shutdown immediate;
RMAN > startup nomount;
RMAN > Alter database mount standby database;

=========================
REM RMAN > restore standby controlfile from “f:/std_ctl.ctl”; [If controlfile backup was taken successfully]
REM RMAN> shutdown immediate;
REM RMAN> startup mount;
=========================

Step 6. Start Replication and Check Sync status

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

SQL>SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#)
"Difference" FROM (SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME )
IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH, (SELECT THREAD# ,SEQUENCE#
FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL
WHERE ARCH.THREAD# = APPL.THREAD# ORDER BY 1;

Note - In case of unsuccessful backup of control files, we need to replace control files on standby server 2. In this case one error comes
Error code: ORA-38868 
Description: warning: the control file may have incorrect data file structure
Cause: This control file was created or converted based on a control file from a time different from the time of the database.
Action: Open database read-only to synchronize the control file with the database dictionary. 

Comments