#查看以resetlogs打开的历史
SQL> SELECT a.INCARNATION#,a.RESETLOGS_CHANGE#,to_char(a.RESETLOGS_TIME,'YYYY-MM-DD HH24:MI:SS'),a.STATUS FROM v$database_incarnation a;
INCARNATION# RESETLOGS_CHANGE# TO_CHAR(A.RESETLOGS_TIME,'YYYY STATUS
1 1 2009-08-15 00:16:43 PARENT
2 945184 2018-01-26 17:51:21 PARENT
3 14476325 2018-02-02 16:12:25 PARENT
4 14479418 2018-02-02 16:29:15 PARENT
5 14662006 2018-02-02 17:38:38 PARENT
6 14940997 2018-02-05 15:26:21 ORPHAN
7 14997019 2018-02-05 15:53:31 CURRENT
#修改CURRENT的INCARNATION
rman target /
RMAN> shutdown immediate;
RMAN> startup mount;
RMAN> reset database to incarnation 5;
#执行不完全恢复
run {
shutdown immediate;
startup mount;
set until time = "to_date('05-02-18 05:00','dd-mm-yy hh24:mi:ss')";
restore database;
recover database;
alter database open resetlogs;
}
SQL> SELECT a.INCARNATION#,a.RESETLOGS_CHANGE#,to_char(a.RESETLOGS_TIME,'YYYY-MM-DD HH24:MI:SS'),a.STATUS FROM v$database_incarnation a;
INCARNATION# RESETLOGS_CHANGE# TO_CHAR(A.RESETLOGS_TIME,'YYYY STATUS
1 1 2009-08-15 00:16:43 PARENT
2 945184 2018-01-26 17:51:21 PARENT
3 14476325 2018-02-02 16:12:25 PARENT
4 14479418 2018-02-02 16:29:15 PARENT
5 14662006 2018-02-02 17:38:38 PARENT
6 14940997 2018-02-05 15:26:21 ORPHAN
7 14997019 2018-02-05 15:53:31 CURRENT
#修改CURRENT的INCARNATION
rman target /
RMAN> shutdown immediate;
RMAN> startup mount;
RMAN> reset database to incarnation 5;
#执行不完全恢复
run {
shutdown immediate;
startup mount;
set until time = "to_date('05-02-18 05:00','dd-mm-yy hh24:mi:ss')";
restore database;
recover database;
alter database open resetlogs;
}
总结:穿越incarnation后,将会产生孤儿incarnation(orphan),这个时候最好重新备份下数据库
本文转自1321385590 51CTO博客,原文链接:http://blog.51cto.com/linux10000/2069036,如需转载请自行联系原作者