恢复测试
对数据文件的指定时间恢复测试
环境:oracle11.2.0.1
1.创建表t04 create table t04 as select * from t01; 当前存在的表 t03\t042.备份全库 backup as compressed backupset database format '/home/oracle/bak_dir/whole_%d_%U'; tag=TAG20170605T1347103.切换归档日志 sql 'alter system archive log current'; 4.系统时间 SQL> alter session set nls_date_format="yyyy-mm-dd hh24:mi:ss"; SQL> selectsysdate from dual; SYSDATE ------------------- 2017-06-05 13:51:155.删除t04 drop table t046.备份全库 backup as compressed backupset database format '/home/oracle/bak_dir/whole_%d_%U'; tag=TAG20170605T1354127.使数据文件离线RMAN>sql 'alter database datafile 6 offline'; 8.删除数据文件 [oracle@Oracle02 orcl]$ rm -f clinics01.dbf9.恢复 run{ sql 'alter session set nls_date_format="yyyy-mm-dd hh24:mi:ss"'; restore datafile 6from tag=TAG20170605T134710; recover datafile 6until time '2017-06-05 13:51:10'; sql 'alter database datafile 6 online'; }
结论: t04表仍不存在,数据文件仍然会被恢复到删除t04表后的时间。对单个文件指定时间点恢复失败
对整库指定时间恢复
1.查看备份集RMAN> list backup summary; List of Backups =============== KeyTY LV S Device Type Completion Time #Pieces #Copies Compressed Tag ------- -- -- - ----------- --------------- ------- ------- ---------- --- 656BFA DISK26-MAY-1711NOTAG20170526T233019 657BFA DISK26-MAY-1711NOTAG20170526T233019 659BAA DISK26-MAY-1711NOTAG20170526T233127 660BFA DISK26-MAY-1711NOTAG20170526T233128 661BAA DISK27-MAY-1711NOTAG20170527T233004 663BFA DISK27-MAY-1711NOTAG20170527T233019 664BFA DISK27-MAY-1711NOTAG20170527T233019 666BAA DISK27-MAY-1711NOTAG20170527T233127 667BFA DISK27-MAY-1711NOTAG20170527T233129 669BAA DISK28-MAY-1711NOTAG20170528T233003 670BFA DISK28-MAY-1711NOTAG20170528T233019 671BFA DISK28-MAY-1711NOTAG20170528T233019 673BAA DISK28-MAY-1711NOTAG20170528T233127 674BFA DISK28-MAY-1711NOTAG20170528T233128 675BAA DISK29-MAY-1711NOTAG20170529T233003 676BAA DISK29-MAY-1711NOTAG20170529T233003 677BFA DISK29-MAY-1711NOTAG20170529T233019 678BFA DISK29-MAY-1711NOTAG20170529T233019 679BFA DISK29-MAY-1711NOTAG20170529T233019 680BAA DISK29-MAY-1711NOTAG20170529T233127 681BFA DISK29-MAY-1711NOTAG20170529T233128 682BAA DISK30-MAY-1711NOTAG20170530T233003 683BAA DISK30-MAY-1711NOTAG20170530T233003 684BFA DISK30-MAY-1711NOTAG20170530T233018 685BFA DISK30-MAY-1711NOTAG20170530T233018 686BFA DISK30-MAY-1711NOTAG20170530T233018 687BAA DISK30-MAY-1711NOTAG20170530T233127 688BFA DISK30-MAY-1711NOTAG20170530T233128 689BAA DISK31-MAY-1711NOTAG20170531T233003 690BAA DISK31-MAY-1711NOTAG20170531T233003 691BFA DISK31-MAY-1711NOTAG20170531T233019 692BFA DISK31-MAY-1711NOTAG20170531T233019 693BFA DISK31-MAY-1711NOTAG20170531T233019 694BAA DISK31-MAY-1711NOTAG20170531T233127 695BFA DISK31-MAY-1711NOTAG20170531T233129 696BAA DISK01-JUN-1711NOTAG20170601T233004 697BAA DISK01-JUN-1711NOTAG20170601T233004 698BAA DISK01-JUN-1711NOTAG20170601T233004 699BFA DISK01-JUN-1711NOTAG20170601T233020 700BFA DISK01-JUN-1711NOTAG20170601T233020 701BFA DISK01-JUN-1711NOTAG20170601T233020 702BAA DISK01-JUN-1711NOTAG20170601T233129 703BFA DISK01-JUN-1711NOTAG20170601T233130 704BAA DISK02-JUN-1711NOTAG20170602T233004 705BAA DISK02-JUN-1711NOTAG20170602T233004 706BFA DISK02-JUN-1711NOTAG20170602T233029 707BFA DISK02-JUN-1711NOTAG20170602T233029 708BFA DISK02-JUN-1711NOTAG20170602T233029 709BAA DISK02-JUN-1711NOTAG20170602T233137 710BFA DISK02-JUN-1711NOTAG20170602T233139 711BAA DISK03-JUN-1711NOTAG20170603T233004 712BAA DISK03-JUN-1711NOTAG20170603T233004 713BAA DISK03-JUN-1711NOTAG20170603T233004 714BFA DISK03-JUN-1711NOTAG20170603T233031 715BFA DISK03-JUN-1711NOTAG20170603T233031 716BFA DISK03-JUN-1711NOTAG20170603T233031 717BAA DISK03-JUN-1711NOTAG20170603T233139 718BFA DISK03-JUN-1711NOTAG20170603T233140 719BAA DISK04-JUN-1711NOTAG20170604T233004 720BAA DISK04-JUN-1711NOTAG20170604T233004 721BFA DISK04-JUN-1711NOTAG20170604T233029 722BFA DISK04-JUN-1711NOTAG20170604T233029 723BFA DISK04-JUN-1711NOTAG20170604T233029 724BAA DISK04-JUN-1711NOTAG20170604T233138 725BFA DISK04-JUN-1711NOTAG20170604T233139RMAN> 2.指定时间恢复库 run{ sql 'alter session set nls_date_format="yyyy-mm-dd hh24:mi:ss"'; set until time "to_date('2017-05-3100:00:00','yyyy-mm-dd hh24:mi:ss')"; restore database; recover database; alter database open resetlogs; }
结论:对整库可实现指定时间恢复
【恢复测试】
推荐阅读
- 布丽吉特,人生绝对的赢家
- 进必趋|进必趋 退必迟,问起对 视勿移
- 对称加密和非对称加密的区别
- 对抗抑郁最好的方法
- 装聋作哑,关系融洽
- 社保代缴公司服务费包含哪些
- 数组常用方法一
- 幸福的婚姻不争对错!读《你要的是幸福还是对错》有感。
- 把一切献给现在
- 年轻人对未来迷茫时该怎么办()