RMAN还原控制文件(二)

2015-02-03 21:33:34 · 作者: · 浏览: 84
14016 Feb? 1 19:11 control03.ctl
-rw-r----- 1 oracle oinstall? 9814016 Feb? 1 19:11 control02.ctl
-rw-r----- 1 oracle oinstall? 9814016 Feb? 1 19:11 control01.ctl
[root@oracle11g test]# rm -rf control*.ctl
[root@oracle11g test]# ls -lrt
total 2185068
-rw-r----- 1 oracle oinstall? 52429312 Feb? 1 11:36 redo02.log
-rw-r----- 1 oracle oinstall? 20979712 Feb? 1 11:37 temp01.dbf
-rw-r----- 1 oracle oinstall? 52429312 Feb? 1 19:13 redo03.log
-rw-r----- 1 oracle oinstall? 11804672 Feb? 1 19:14 users01.dbf
-rw-r----- 1 oracle oinstall 492838912 Feb? 1 19:14 undotbs01.dbf
-rw-r----- 1 oracle oinstall? 52436992 Feb? 1 19:14 test01.dbf
-rw-r----- 1 oracle oinstall 838868992 Feb? 1 19:14 system01.dbf
-rw-r----- 1 oracle oinstall 576724992 Feb? 1 19:14 sysaux01.dbf
-rw-r----- 1 oracle oinstall? 52429312 Feb? 1 19:14 redo01.log
-rw-r----- 1 oracle oinstall 104865792 Feb? 1 19:14 example01.dbf



向测试表t2中插入一些数据库
SQL> insert into t2 select * from dba_objects;


51319 rows created.


SQL> select count(*) from t2;


? COUNT(*)
----------
? ? 102560


SQL> commit;


Commit complete.


?


这里因为是从linux操作系统层面删除了所有控制文件,因为在数据库没有关闭的情况下文件的句柄没有释放所以数据库还能运行。


人为将数据库异常终止
[root@oracle11g test]# ps -ef | grep smon
oracle? ? 3463? ? 1? 0 22:30 ?? ? ? ? 00:00:00 ora_smon_test
root? ? ? 3179? 3123? 0 22:45 pts/3? ? 00:00:00 grep smon
[root@oracle11g test]# kill -9 3463



启动数据库:
SQL> startup
ORACLE instance started.


Total System Global Area? 327155712 bytes
Fixed Size? ? ? ? ? ? ? ? ? 1273516 bytes
Variable Size? ? ? ? ? ? 138412372 bytes
Database Buffers? ? ? ? ? 184549376 bytes
Redo Buffers? ? ? ? ? ? ? ? 2920448 bytes
ORA-00205: error in identifying control file, check alert log for more info



alert日志的内容如下:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/test/control01.ctl'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Sun Feb 01 19:18:18 CST 2015
ORA-205 signalled during: ALTER DATABASE? MOUNT...



找不到控制文件不能将数据库置于mount状态.现在通过备份来还原控制文件执行完全数据库恢复:
RMAN> restore controlfile from '/u01/app/oracle/10.2.0/db/dbs/c-2155613261-20150128-0d';


Starting restore at 01-FEB-15
using channel ORA_DISK_1


channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:05
output filename=/u01/app/oracle/oradata/test/control01.ctl
output filename=/u01/app/oracle/oradata/test/control02.ctl
output filename=/u01/app/oracle/oradata/test/control03.ctl
Finished restore at 01-FEB-15



RMAN> sql 'alter database mount';


sql statement: alter database mount
released channel: ORA_DISK_1


SQL> select status from v$instance;


STATUS
------------------------
MOUNTED



执行完全恢复
RMAN> recover database;


Starting recover at 01-FEB-15
Starting implicit crosscheck backup at 01-FEB-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
Crosschecked 3 objects
Finished implicit crosscheck backup at 01-FEB-15


Starting implicit crosscheck copy at 01-FEB-15
using channel ORA_DISK_1
Crosschecked 6 objects
Finished implicit crosscheck copy at 01-FEB-15


searching for all files in the recovery area
cataloging files...
no files cataloged


using channel ORA_DISK_1


starting media recovery


archive log thread 1 sequence 17 is already on disk as file /u01/app/oracle/oradata/test/redo02.log
archive log thread 1 sequence 18 is already on disk as file /u01/app/oracle/oradata/test/redo03.log
archive log thread 1 sequence 19 is already on disk as file /u