Database incarnation is a new version of the database that happens when you reset the online redo logs using alter database open resetlogs;

Database incarnation falls into following category Current, Parent, Ancestor and Sibling

       i) Current Incarnation : The database incarnation in which the database is currently generating redo.

       ii) Parent Incarnation : The database incarnation from which the current incarnation branched following an OPEN RESETLOGS operation.

       iii) Ancestor Incarnation : The parent of the parent incarnation is an ancestor incarnation. Any parent of an ancestor incarnation is also an ancestor incarnation.

       iv) Sibling Incarnation : Two incarnations that share a common ancestor are sibling incarnations if neither one is an ancestor of the other.
.

we can view the status of our database incarnation using the command,

select * from v$database_incarnation;

list incarnation;

in this I have recovered a deleted table in the previous incarnation.

RMAN> backup database;
 
SQL> 
create
 table test 
as select * from
 all_objects;
Table created.
 
SQL> 
select
 current_scn 
from
 v$database;
 
CURRENT_SCN
-----------
     547181

SQL> 
delete from
 test;
49309 rows deleted.
 
SQL> 
commit;
Commit complete.
 
SQL> 
select
 current_scn 
from
 v$database;
 
CURRENT_SCN
-----------
     547891

SQL> 
drop
 table test;
Table dropped.
SQL> 
select
 current_scn 
from
 v$database;
 
CURRENT_SCN
-----------
     547917
SQL> 
alter
 system switch logfile;
System altered.

SQL> 
select
 incarnation#, resetlogs_change# 
from
 v$database_incarnation;
 
INCARNATION# RESETLOGS_CHANGE#
------------ -----------------
           1                 1
           2            534907

SQL> 
shutdown immediate
SQL> 
startup
 mount
RMAN> run
2> {
3> set until scn=547891;
4> restore database;
5> recover database;
6> }
RMAN> alter database open resetlogs;

SQL> 
select
 incarnation#, resetlogs_change# 
from
 v$database_incarnation;
 
INCARNATION# RESETLOGS_CHANGE#
------------ -----------------
           1                 1
           2            534907
           3            547896
 
SQL> 
select * from
 test;
no rows selected
SQL>

RMAN> shutdown immediate
RMAN> startup mount
RMAN> reset database to incarnation 2;
database reset to incarnation 2
 
RMAN> run
2> {
3> set until scn=547181;
4> restore database;
5> recover database;
6> }

RMAN> alter database open resetlogs;
database opened

SQL> 
select
 count(1) 
from
 test;
 
  COUNT(1)
----------
     49309
SQL>
Recent Posts

Start typing and press Enter to search