一 什么是Trial Recovery
官方解释:A trial recovery applies redo in a way similar to normal media recovery, but it never writes its changes to disk and it always rolls back its changes. Trial recovery occurs only in memory.
trial recovery基本上类似于正常的介质恢复,应用redo的过程仅仅发生在内存中,不会把数据的改变写到磁盘。说白了就是测试介质恢复过程
二 Trial Recovery如何工作
1 默认,如果恢复由于数据块损坏而卡住或者遇到类似问题,会标记相关块以求继续恢复,同时写错误信息到alert文件。
2 当遭遇如下问题时,Trial Recovery过程会结束
● 超出内存buffer限制
● 遭遇一个不可恢复性错误,即使通过标记坏块也不能解决,比如文件丢失
● 用户取消或者终止恢复会话
● 所有必须的redo已经被应用,即不需要恢复。
当 trial recovery 结束,一切恢复原样,只是错误消息会记录在alter 文件中。运行测试时,注意排除由于内存原因造成测试过程结束的影响。
三 Trial Recovery 的语句
recover ……..test
例如:
recover database test
recover database using backup controlfile until cancel test
recover tablespace users test
recover database until cancel test
注意: 默认trial recovery会在内存中标记(无限制)的坏块,使恢复过程能够继续进行。我们可以指定 allow n corruption 语句 在 recover…..test 后面,以限制可以标记的坏块数。
四 测试过程
正常情况:
RMAN> recover database test;
Starting recover at 05-DEC-12
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 1 is already on disk as file /Oracle/archive/1_1_801229657.dbf
archive log thread 1 sequence 2 is already on disk as file /oracle/archive/1_2_801229657.dbf
archive log thread 1 sequence 3 is already on disk as file /oracle/archive/1_3_801229657.dbf
archive log thread 1 sequence 4 is already on disk as file /oracle/archive/1_4_801229657.dbf
archive log thread 1 sequence 5 is already on disk as file /oracle/archive/1_5_801229657.dbf
archive log thread 1 sequence 6 is already on disk as file /oracle/archive/1_6_801229657.dbf
archive log thread 1 sequence 7 is already on disk as file /oracle/archive/1_7_801229657.dbf
archive log thread 1 sequence 8 is already on disk as file /oracle/archive/1_8_801229657.dbf
archive log thread 1 sequence 9 is already on disk as file /oracle/archive/1_9_801229657.dbf
archive log thread 1 sequence 10 is already on disk as file /oracle/archive/1_10_801229657.dbf
archive log thread 1 sequence 11 is already on disk as file /oracle/archive/1_11_801229657.dbf
archive log thread 1 sequence 12 is already on disk as file /oracle/archive/1_12_801229657.dbf
archive log thread 1 sequence 13 is already on disk as file /oracle/archive/1_13_801229657.dbf
archive log thread 1 sequence 14 is already on disk as file /oracle/archive/1_14_801229657.dbf
archive log filename=/oracle/archive/1_1_801229657.dbf thread=1 sequence=1
archive log filename=/oracle/archive/1_2_801229657.dbf thread=1 sequence=2
archive log filename=/oracle/archive/1_3_801229657.dbf thread=1 sequence=3
archive log filename=/oracle/archive/1_4_801229657.dbf thread=1 sequence=4
archive log filename=/oracle/archive/1_5_801229657.dbf thread=1 sequence=5
archive log filename=/oracle/archive/1_6_801229657.dbf thread=1 sequence=6
archive log filename=/oracle/archive/1_7_801229657.dbf thread=1 sequence=7
archive log filename=/oracle/archive/1_8_801229657.dbf thread=1 sequence=8
archive log filename=/oracle/archive/1_9_801229657.dbf thread=1 sequence=9
RMAN-11006: WARNING: test recovery results:
ORA-10574: Test recovery did not corrupt any data block
ORA-10573: Test recovery tested redo from change 2779426987 to 2779427975
ORA-10572: Test recovery canceled due to errors
ORA-10581: Can not modify redo log header during test recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 05-DEC-12