使用RMAN执行不完全恢复操作时需要完成的一个工作是建立恢复目标(方式)。它是恢复进程的终点,通常我们基于一个时间点、指定的SCN号或是一个日志序列号来标识它。使用UNTIL time | SCN | sequence参数。
1. 时间点恢复
--控制文件已恢复 startup mount;
Eg: run{ allocate channel c2 device type disk format=’c:/backup/ ora_mck54983_1_1’;
set untile time “to_date(‘2009-12-18 13:10:00’,’YYYY-mm-dd hh24:mi:ss’)”;
restore database; recover database; } alter database open resetlogs;
或是不用RUN块,但必须已指定备份位置。
EG:startup mount; restore database until time “…………………………….”;
Recover database until time “………………………”; alter database open resetlogs;
最后要强调的是必须具备我们所指定的恢复时间之前生成的备份,此外还要所有的归档日志。可以使用 list 和 report 命令,确定RMAN还原库可以使用的备份。
2. SCN恢复
--startup mount;
restore database until scn 1236546; recover database until scn 1236546;
alter database open resetlogs;
3. 日志序列恢复
--startup mount;
restore database until sequence 20 thread 1;
recover database until sequence 20 thread 1; alter database open resetlogs;
还原到日志序列为100(不包含100)的数据库。
RMAN不支持类似于sql*plus的基于删除的恢复(与日志恢复类似)