How to use Incarnation in Oracle 10G

andy huang's picture

OS:Red Hat Linux As 5
DB Version:10.2.0.4

In 9i,we open the database with resetlogs just only once when we do the incomplete recover,but in the 10g, it can open the database with resetlogs more than once,the flowing test is show how to open the database with resetlogs many times.
1. There are some backup sets:

RMAN> list backup summary;
List of Backups
===============
Key     TY LV S Device Type Completion Time   #Pieces #Copies Compressed Tag
------- -- -- - ----------- ----------------- ------- ------- ---------- ---
16      B  F  A DISK        20120602 11:50:32 1       1       NO         TAG20120602T114931
17      B  F  A DISK        20120602 11:50:39 1       1       NO         TAG20120602T114931
18      B  F  A DISK        20120602 11:50:42 1       1       NO         TAG20120602T115041
19      B  A  A DISK        20120602 11:50:45 1       1       NO         TAG20120602T115044

2. List the current Oracle incarnation:

RMAN> list incarnation;
List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       ORACL    1823011607       PARENT  1          20050630 19:09:40
2       2       ORACL    1823011607       CURRENT 446075     20120310 06:07:22

3. Do the incomplete recovery:

run{
  set until time "to_date('2012-06-05 21:05:00','YYYY-MM-DD HH24:MI:SS')";
  restore database;
  recover database;
}

alter database open resetlogs;

4. List the current Oracle incarnation again:

RMAN> list incarnation;

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       ORACL    1823011607       PARENT  1          20050630 19:09:40
2       2       ORACL    1823011607       PARENT  446075     20120310 06:07:22
3       3       ORACL    1823011607       CURRENT 1035203    20120605 21:11:15

5. Reset the incarnation to 2:

startup mount
reset database to incarnation 2;

6. Do the incomplete recover and open resetlogs again:

run{
  set until time "to_date('2012-06-05 21:05:00','YYYY-MM-DD HH24:MI:SS')";
  restore database;
  recover database;
}

alter database open resetlogs;

7. List the incarnation again:

RMAN> list incarnation;
List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       ORACL    1823011607       PARENT  1          20050630 19:09:40
2       2       ORACL    1823011607       PARENT  446075     20120310 06:07:22
3       3       ORACL    1823011607       ORPHAN  1035203    20120605 21:11:15
4       4       ORACL    1823011607       CURRENT 1035379    20120605 21:24:13

Note, we can see the incarnation 3 has become an "ORPHAN".

-- The End --