Wrong Incarnation cause RMAN-06094: datafile 1 must be restored

When trying to recover the standby database from an incremental backup, I got following error :

RMAN> recover database preview;

Starting recover at 06-MAR-19
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=2240 instance=obiprod1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=2582 instance=obiprod1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=175 instance=obiprod1 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=349 instance=obiprod1 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 03/06/2019 12:38:52
RMAN-06094: datafile 1 must be restored

RMAN>

As per oracle support:

Note: Even though the above is reporting errors on datafile 1, this is not necessarily the full extent of the problem. Rather than printing an error message for each file in question (imagine a system with five thousand or more datafiles!), RMAN is only showing you the first file with a problem

Since I also restored the new standby control file taken from primary database.I checked the location of files showing original location(primary database). RMAN should switch these data files  to copy but not.

RMAN> SWITCH DATABASE TO COPY;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of switch to copy command at 03/06/2019 12:45:22
RMAN-06571: datafile 1 does not have recoverable copy

I’ve followed all steps in oracle document but no help.

This standby database is using as a snapshot database for application team.I did role change many times between snapshot <–>Physical standby.

I checked the incarnation of standby database.

RMAN> list incarnation;

List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
——- ——- ——– —————- — ———- ———-
1 1 OBIPROD 1016471270 PARENT 1 07-JUL-14
2 2 OBIPROD 1016471270 PARENT 1594143 08-NOV-17
3 3 OBIPROD 1016471270 PARENT 55744422 06-APR-18
4 4 OBIPROD 1016471270 PARENT 104769033 25-APR-18
5 5 OBIPROD 1016471270 ORPHAN 699355636 18-SEP-18
6 6 OBIPROD 1016471270 CURRENT 948016826 12-NOV-18   —>IT MUST BE THE SAME INCARNATION WITH PRIMARY

RMAN>

On Primary side:

RMAN> list incarnation;

List of Database Incarnations

DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
——- ——- ——– —————- — ———- ———-
1 1 OBIPROD 1016471270 PARENT 1 07-JUL-14
2 2 OBIPROD 1016471270 PARENT 1594143 08-NOV-17
3 3 OBIPROD 1016471270 PARENT 55744422 06-APR-18
4 4 OBIPROD 1016471270 CURRENT 104769033 25-APR-18

So standby database incarnation in wrong level.

rman target /
reset database to incarnation 4;

switch database to copy; –>It was successfully switched the data files name.

recover database noredo; –>Successfully recover competed.

 

As a conclusion  RMAN NEVER allow you recover database when database (or backup) is in wrong incarnation

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *