使用RMAN实现不完全恢复(一)

2014-11-24 18:35:51 · 作者: · 浏览: 0

1. 故障原因


使用ruby将ql用户下的表全部彻底删除,回收站没有,因此使用“闪回表”失效;


flashback database被关闭;


只有通过介质恢复。


2. 使用RMAN实现基于时间点的恢复


2.1 启动数据库到mount
SQL> startup nomount;



Total System Global Area 2254802944 bytes


Fixed Size 2215344 bytes


Variable Size 1375732304 bytes


Database Buffers 872415232 bytes


Redo Buffers 4440064 bytes



2.2 恢复控制文件到误删除之前的一个副本
RMAN> restore controlfile from '/opt/oracle/11g/flash_recovery_area/ORCL//2012_06_03/o1_mf_s_784987822_7worxgk6_.bkp';




2.3 mount数据库
SQL> alter database mount;



Database altered.



2.4 将数据库文件恢复到特定时间点


[oracle@localhost ~]$ export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'



[oracle@localhost ~]$ rman target /;





RMAN> run



2> {



3> set until time '2012-06-06 21:00:00';



4> restore database;



5> recover database



6> };





executing command: SET until clause



-- 开始介质恢复



Starting restore at 2012-06-07 09:32:23



using channel ORA_DISK_1





channel ORA_DISK_1: starting datafile backup set restore



channel ORA_DISK_1: specifying datafile(s) to restore from backup set



channel ORA_DISK_1: restoring datafile 00001 to /opt/oracle/11g/oradata/o01.dbf



channel ORA_DISK_1: restoring datafile 00002 to /opt/oracle/11g/oradata/o01.dbf



channel ORA_DISK_1: restoring datafile 00003 to /opt/oracle/11g/oradata/os01.dbf



channel ORA_DISK_1: restoring datafile 00004 to /opt/oracle/11g/oradata/o1.dbf



channel ORA_DISK_1: restoring datafile 00005 to /opt/oracle/11g/oradata/oe01.dbf



channel ORA_DISK_1: restoring datafile 00006 to /opt/oracle/11g/software/s.dbf



channel ORA_DISK_1: reading from backup piece /opt/oracle/11g/flash_recovRCL/backupset/2012_06_03/o1_mf_nnndf_TAG20120603T120856_7wortx30_.bkp



channel ORA_DISK_1: piece handle=/opt/oracle/11g/flash_recovery_area/ORCLTAG20120603T120856_7wortx30_.bkp tag=TAG20120603T120856



channel ORA_DISK_1: restored backup piece 1



channel ORA_DISK_1: restore complete, elapsed time: 00:01:08



Finished restore at 2012-06-07 09:33:31



-- 开始日志恢复



Starting recover at 2012-06-07 09:33:31



using channel ORA_DISK_1





starting media recovery





archived log for thread 1 with sequence 294 is already on disk as file /oORCL/archivelog/2012_06_04/o1_mf_1_294_7wqlknmq_.arc



archived log for thread 1 with sequence 295 is already on disk as file /oORCL/archivelog/2012_06_04/o1_mf_1_295_7wrdpv34_.arc



archived log for thread 1 with sequence 296 is already on disk as file /oORCL/archivelog/2012_06_05/o1_mf_1_296_7wtd8745_.arc



archived log for thread 1 with sequence 297 is already on disk as file /oORCL/archivelog/2012_06_05/o1_mf_1_297_7ww7rbh6_.arc



archived log for thread 1 with sequence 298 is already on disk as file /oORCL/archivelog/2012_06_06/o1_mf_1_298_7wx5rl22_.arc



archived log for thread 1 with sequence 299 is already on disk as file /olog



archived log file name=/opt/oracle/11g/flash_recovery_area/ORCL/archivelo.arc thread=1 sequence=294



archived log file name=/opt/oracle/11g/flash_recovery_area/ORCL/archivelo.arc thread=1 sequence=295



archived log file name=/opt/oracle/11g/flash_recovery_area/ORCL/archivelo.arc thread=1 sequence=296



archived log file name=/opt/oracle/11g/flash_recovery_area/ORCL/archivelo.arc thread=1 sequence=297



archived log file name=/opt/oracle/11g/flash_recovery_area/ORCL/archivelo.arc thread=1 sequence=298



archived log file name=/opt/oracle/11g/oradata/orcl/redo02.log thread=1 s



media recovery complete, elapse