探索Oracle之RMAN_07整个业务表空间丢失恢复

2014-11-24 18:50:12 · 作者: · 浏览: 1

1、 整个业务表空间丢失恢复


注意:以下的所有实验,都是基于上面的全库备份来做的恢复。


2.1 删除wwl表空间的所有数据文件


[root@wwldb ~]# cd /DBData/WWL/


[root@wwldb WWL]# rm -rf wwl*


[root@wwldb WWL]# ll


总计 881068


-rw-r----- 1 oracle oinstall 31457792 06-22 01:34 redo02.log


-rw-r----- 1 oracle oinstall 31457792 06-22 02:14 redo03.log


-rw-r----- 1 oracle oinstall 27263795206-22 02:08 sysaux01.dbf


-rw-r----- 1 oracle oinstall 50332467206-22 02:09 system01.dbf


-rw-r----- 1 oracle oinstall 20979712 05-29 22:00 temp01.dbf


-rw-r----- 1 oracle oinstall 26222592 06-22 02:08 undotbs01.dbf


-rw-r----- 1 oracle oinstall 5251072 06-22 01:34 users01.dbf



2.2 启动数据库,报如下错误。


SQL> conn / as sysdba


Connected to an idle instance.


SQL> startup


ORACLE instance started.



Total System Global Area 285212672 bytes


Fixed Size 1218968 bytes


Variable Size 100664936 bytes


Database Buffers 176160768 bytes


Redo Buffers 7168000 bytes


Database mounted.


ORA-01157: cannot identify/lock data file 5- see DBWR trace file


ORA-01110: data file 5:'/DBData/WWL/wwl001.dbf'



2.3 检查跟踪文件,非常清晰的告诉丢失了有文件找不到,丢失了。



***SERVICE NAME:() 2012-06-22 09:17:38.573


***SESSION ID:(167.1) 2012-06-22 09:17:38.573


ORA-01157:Message 1157 not found; No message file for product=RDBMS, facility=ORA;arguments: [5]


ORA-01110:Message 1110 not found; No message file for product=RDBMS, facility=ORA;arguments: [5] [/DBData/WWL/wwl001.dbf]


ORA-27037:Message 27037 not found; No message file for product=RDBMS, facility=ORA


LinuxError: 2: No such file or directory


Additionalinformation: 3


ORA-01157:Message 1157 not found; No message file for product=RDBMS, facility=ORA;arguments: [6]


ORA-01110:Message 1110 not found; No message file for product=RDBMS, facility=ORA;arguments: [6] [/DBData/WWL/wwl002.dbf]


ORA-27037:Message 27037 not found; No message file for product=RDBMS, facility=ORA


LinuxError: 2: No such file or directory


Additionalinformation: 3


ORA-01157:Message 1157 not found; No message file for product=RDBMS, facility=ORA;arguments: [7]


ORA-01110:Message 1110 not found; No message file for product=RDBMS, facility=ORA;arguments: [7] [/DBData/WWL/wwl003.dbf]


ORA-27037:Message 27037 not found; No message file for product=RDBMS, facility=ORA


LinuxError: 2: No such file or directory


Additionalinformation: 3



由如上的跟踪信息我们得出是由于/DBData/WWL/wwl001.dbf/DBData/WWL/wwl002.dbf/DBData/WWL/wwl001.dbf这三个文件丢失导致数据库无法起来,并且这三个文件同时构成了一个WWL表空间。在这个表空间中存储了各种各样重要的数据。同样我们可以按照之前的方法通过恢复数据文件的方式来进行数据恢复,介于这次丢失的是所有数据文件,数量比较多,而且如果对所有数据文件做恢复,不仅大量的增加的工作量,同时也增加的恢复的风险。所以在这里我们通过使用RMAN执行表空间恢复的方式来进行恢复。当然基于表空间的恢复也分两种,一直是在不影响数据库其它业务情况下的在线联机恢复,还有一种是停机停业务的恢复,详细见如下:


2.4 恢复方法一:零停机,在线恢复


开始执行恢复操作,分为如下七个步骤:


1、查看数据库状态是open的,我们刚才的删除数据文件没有对库照成太大的影响。


SQL>select instance_name,status from v$instance;


INSTANCE_NAME STATUS


----------------------------


WWL OPEN



2、wwl表空间离线


SQL>alter tablespace wwl offline for recover;


Tablespacealtered.