Friday, March 14, 2014

Oracle RMAN -- ORA-19909: datafile 1 belongs to an orphan incarnation

Problem

You are cloning a database from production and while recovering the cloned database you get the error below:

SQL> recover database using backup controlfile until cancel;
ORA-00283: recovery session canceled due to errors
ORA-19909: datafile 1 belongs to an orphan incarnation
ORA-01110: data file 1: 'F:\ORACLE\ORADATA\DB2\SYSTEM01.DBF'


Incarnation table for the cloned database is:

RMAN> list incarnation;

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN       Reset Time
------- ------- -------- ---------------- ---       ----------      ----------
1       1       DB2      3376048819       PARENT  994063          10-SEP-12
2       2       DB2      3376048819       CURRENT 11259980398142 30-APR-13


Incarnation table for the original database

RMAN> list incarnation;

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       DB1      3376048819       PARENT  1          03-NOV-11
2       2       DB1      3376048819       CURRENT 994063     10-SEP-12


Recovery failed because of current incarnation was wrongly set to newly created incarnation branch 2 of 30-APR-13.

 

Solution

Check if Fast Recovery Area is configured and any controlfile autobackups exist in the FRA for the cloned database. During recovery RMAN will catalog any files in the configured FRA. This will cause current incarnation to be reset to the newly detected incarnation branch.


SQL> show parameter db_recovery_file_dest

NAME                       TYPE           VALUE
-------------------------- ----------- ----------------------------
db_recovery_file_dest      string      I:\Oracle\fast_recovery_area
db_recovery_file_dest_size big integer 100G



I:\>dir I:\Oracle\fast_recovery_area\DB2\AUTOBACKUP\2013_04_30\O1_MF_S_814122206_8QZDRH30_.BKP
 Volume in drive I is Apps
 Volume Serial Number is 04E6-D1CE

 Directory of I:\Oracle\fast_recovery_area\DB2\AUTOBACKUP\2013_04_30

04/30/2013  04:03 PM        10,584,064 O1_MF_S_814122206_8QZDRH30_.BKP
               1 File(s)     10,584,064 bytes
               0 Dir(s)  60,309,872,640 bytes free

To solve the problem and make the recovery proceed without any errors either unconfigrue FRA, delete any backups in the FRA, or reset incarnation for the cloned database to match the incarnation of the production database:

RMAN> list incarnation;

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN       Reset Time
------- ------- -------- ---------------- --- ----------      ----------
1       1       DB2      3376048819       PARENT  994063          10-SEP-12
2       2       DB2      3376048819       CURRENT 11259980398142 30-APR-13

RMAN> reset database to incarnation 1;

database reset to incarnation 1

RMAN>


Proceed with recovery.

1 comment:

Unknown said...

Wonderful!!!
this really helped me.