最近在对备份做周期性的测试。基本上做的时对指定时间点的恢复。本测试脚本是在有catalog DB,通过legato来实现的。下面帖上几步走:
step 01 启动DB到nomount状态
alter database nomount;
step 02 连接catalog和target DB,执行恢复。
connect catalog rman/password@catdb
connect target /
run {
allocate channel t1 device type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=szvsx009,NSR_CLIENT=szvsv111)';
set until time "to_date('2006-05-31 14:00:00','yyyy-mm-dd hh24:mi:ss')";
restore controlfile;
restore database;
release channel t1;
}
step 03 更改数据库到mount状态
alter database mount;
step 04 recovery database 到指定的时间点
run {
allocate channel t1 device type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=szvsx009,NSR_CLIENT=szvsv111)';
set until time "to_date('2006-05-31 14:00:00','yyyy-mm-dd hh24:mi:ss')";
recover database;
release channel t1;
}
step 05 打开数据到read only 状态,检查recovery的result.
alter database open read only;