RMAN-20011: target database incarnation is not current in recovery catalog
Hello experts, I am Avinash. I am learning RMAN backup and recovery. I need your expert help in understanding restoring the database to previous incarnation.
What I am trying to understand here is that, is it possible to restore a database to previous incarnation after I have already restored it to one of the previous incarnations earlier? If yes, how to do so?
OS: RHEL5
Oracle Database: 11gr2
database: testdb2 on prod.linux.in
catalog database: catdb on stan.linux.in
I backed up my testdb2 database using BACKUP DATABASE PLUS ARCHIVELOG;
In order to perform an incomplete recovery, I deleted one of the control files and restored and recovered the database with RESETLOGS option.
Thus I will have a new incarnation for my testdb database.
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
7417 7418 TESTDB2 1270789963 PARENT 1 11-JUL-2017 17:50:03
7417 7505 TESTDB2 1270789963 CURRENT 238955 11-JUL-2017 19:30:49
I backed up the database as well as archivelogs again.
I repeated incomplete recovery again and opened the database with RESETLOGS option.
I will again have a new incarnation for my testdb database.
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
7417 7418 TESTDB2 1270789963 PARENT 1 11-JUL-2017 17:50:03
7417 7505 TESTDB2 1270789963 PARENT 238955 11-JUL-2017 19:30:49
7417 7672 TESTDB2 1270789963 CURRENT 239892 11-JUL-2017 19:59:08
Now I tried to recover to incarnation 7505.
RMAN> STARTUP FORCE NOMOUNT;
RMAN> reset database to incarnation 7505;
RMAN> restore controlfile;
RMAN> alter database mount;
RMAN> restore database until SCN 238954;
Restore complete.
RMAN> recover database until SCN 238956;
Starting recover at 11-JUL-2017 20:18:03
using channel ORA_DISK_1
using channel ORA_DISK_2
starting media recovery
Finished recover.
RMAN> alter database open resetlogs;
database opened
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
RMAN> list incarnation of database testdb2;
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
---------- ---------- ----------------- ---------------- ---------- ----------
7417 7418 TESTDB2 1270789963 PARENT 1 11-JUL-2017 17:50:03
7417 7505 TESTDB2 1270789963 PARENT 238955 11-JUL-2017 19:30:49
7417 7747 TESTDB2 1270789963 CURRENT 238957 11-JUL-2017 20:18:19
7417 7672 TESTDB2 1270789963 ORPHAN 239892 11-JUL-2017 19:59:08
What I am trying to accomplish here is that I am trying restore the database to the first incarnation 7418. Is it possible to do so?
RMAN> startup force nomount;
RMAN> reset database to incarnation 7418;
RMAN> restore controlfile;
RMAN> alter database mount;
RMAN> restore database until scn 238955;
Restore complete.
RMAN> recover database until scn 238955;
Starting recover at 11-JUL-2017 20:46:43
using channel ORA_DISK_1
using channel ORA_DISK_2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/11/2017 20:46:44
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20011: target database incarnation is not current in recovery catalog.
From the error message I think the mistake I am doing is I am using wrong incarnation number when I am trying to restore? How does one find correct incarnation to reset to?
Also I ll be very glad if you help me understanding ORPHAN incarnation? What is it and what does it mean? How RESETLOGS affects the restore and recovery process?
Thank you.