2016年4月11日 星期一

[ORACLE][RMAN] ControlFile毀損情境一之還原方式(自動修復不一致)

情境:
1. 所有online Control file毀損
2. ControlFile Autobackup OFF
3. 備份完Control file後,DBA手動加了一個tablespace包含Data File,所以上次的Control file備份就沒有剛新增的Data File

環境準備:
1. 手動備份controlfile
RMAN> backup current controlfile;
Starting backup at 11-APR-2016 14:15:54
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=9 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 11-APR-2016 14:15:56
channel ORA_DISK_1: finished piece 1 at 11-APR-2016 14:15:57
piece handle=/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/01r2p6or_1_1 tag=TAG20160411T141555 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 11-APR-2016 14:15:57

2. 新增一個tablespace包含一個Data File
SQL> create tablespace "myTest02" NOLOGGING
  2  datafile '/u01/app/oracle/oradata/orclnofra/myTest_Data02.dbf' SIZE 200M;
Tablespace created.

3. 手動刪除controlfile
[oracle@nofra orclnofra]$ rm control01.ctl
[oracle@nofra orclnofra]$ rm control02.ctl

4. 重新啟動DB會出現如下錯誤
RMAN> startup;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 04/11/2016 14:48:49
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/orclnofra/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

還原語法如下:
1. 在RMAN
restore controlfile from '/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/01r2p6or_1_1';
2. 在RMAN
recover database;
3. 在RMAN
alter database open resetlogs;

完整執行過程:
1.還原Control File
[oracle@nofra ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Apr 11 14:53:36 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database (not started)
RMAN> startup;
Oracle instance started
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 04/11/2016 14:53:44
ORA-00205: error in identifying control file, check alert log for more info
RMAN> restore controlfile from '/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/01r2p6or_1_1';
Starting restore at 11-APR-2016 14:55:12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/orclnofra/control01.ctl
output file name=/u01/app/oracle/oradata/orclnofra/control02.ctl
Finished restore at 11-APR-2016 14:55:13

RMAN> recover database;
Starting recover at 11-APR-2016 14:57:46
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=129 device type=DISK
starting media recovery
archived log for thread 1 with sequence 6 is already on disk as file /u01/app/oracle/oradata/orclnofra/redo03.log
archived log file name=/u01/app/oracle/oradata/orclnofra/redo03.log thread=1 sequence=6
creating datafile file number=5 name=/u01/app/oracle/oradata/orclnofra/myTest_Data01.dbf
archived log file name=/u01/app/oracle/oradata/orclnofra/redo03.log thread=1 sequence=6
creating datafile file number=6 name=/u01/app/oracle/oradata/orclnofra/myTest_Data02.dbf
archived log file name=/u01/app/oracle/oradata/orclnofra/redo03.log thread=1 sequence=6
media recovery complete, elapsed time: 00:00:01
Finished recover at 11-APR-2016 14:57:50

RMAN> alter database open resetlogs;
database opened


沒有留言:

張貼留言