1.查看之前的数据库化身
RMAN> list incarnation of database;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 ORCL 1549746193 PARENT 1 17-APR-19
2 2 ORCL 1549746193 PARENT 1920977 18-OCT-19
2.执行还原
注意:需要使用上一次执行resetlogs命令打开数据库之前的备份来还原数据库
有恢复目录时的还原
startup force nomount
reset database to incarnation 2;
run{
set until time "to_date('2019-11-25 09:47:00','yyyy-mm-dd hh24:mi:ss')";
restore controlfile;
restore database;
recover database;
}
alter database open resetlogs;
没有恢复目录时的还原
startup force nomount;
run{
set until time "to_date('2019-11-25 09:47:00','yyyy-mm-dd hh24:mi:ss')";
restore controlfile from autobackup;
}
alter database mount;
reset database to incarnation 2;
run{
set until scn 3318383;
restore database force;
recover database;
}
alter database open resetlogs;