RAC控制檔案恢復(三種不同情況)
RAC控制檔案恢復(三種不同情況)
測試環境:
系統:LINUX-64
資料庫:10.2.0.1
二節點的RAC(RACDB1,RACDB2),儲存用的ASM
有備份情況下,丟失控制檔案,我們改如何恢復?
一:使用備份的控制檔案恢復,最後需要使用resetlogs開啟。
(1) 備份控制檔案
RMAN> backup current controlfile;
(2) 進行日誌切換和資料修改
RACDB1>alter system switch logfile;
System altered.
RACDB1>create table test2 as select * from dba_users;
Table created.
RACDB1>alter system switch logfile;
System altered.
RACDB1>SELECT thread#,group#,sequence#,status FROM V$log;
THREAD# GROUP# SEQUENCE# STATUS
---------- ---------- ---------- ----------------
1 1 5 ACTIVE
1 2 6 CURRENT
2 3 3 CURRENT
2 4 2 INACTIVE
1 5 4 INACTIVE
(3) 關閉資料庫,刪除控制檔案
RACDB1>shutdown abort;
RACDB2>shutdown abort;
ASMCMD> pwd
+rac_disk/racdb/controlfile
ASMCMD> ls
Current.256.794232615
ASMCMD> rm *
(4) 啟動資料庫,無控制檔案,所以只能到nomount
RACDB1>startup
ORACLE instance started.
Total System Global Area 184549376 bytes
Fixed Size 2019448 bytes
Variable Size 142610312 bytes
Database Buffers 37748736 bytes
Redo Buffers 2170880 bytes
ORA-00205: error in identifying control file, check alert log for more info
(5) 恢復控制檔案
RMAN> restore controlfile from '+RAC_DISK/racdb/backupset/2012_09_28/ncnnf0_tag20120928t003933_0.272.795141579';
RACDB1>alter database mount;
Database altered.
RACDB1>SELECT thread#,group#,sequence#,status FROM V$log;
THREAD# GROUP# SEQUENCE# STATUS
---------- ---------- ---------- ----------------
1 1 2 CURRENT
1 2 0 UNUSED
1 5 1 INACTIVE
2 4 0 UNUSED
2 3 1 CURRENT
(6) 恢復資料庫
先使用auto,恢復到current聯機日誌,oracle會提示找不到歸檔,這時候需要自己手動輸入聯機日誌。如下:
RACDB1>recover database using backup controlfile;
ORA-00279: change 1185078 generated at 09/28/2012 00:40:37 needed for thread 1
ORA-00289: suggestion : +RAC_DISK/racdb/flashback/1_6_795092359.dbf
ORA-00280: change 1185078 for thread 1 is in sequence #6
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
+rac_disk/racdb/onlinelog/group_2.258.794232619 --輸入RACDB1的current聯機日誌
ORA-00279: change 1185078 generated at 09/28/2012 00:40:10 needed for thread 2
ORA-00289: suggestion : +RAC_DISK/racdb/flashback/2_2_795092359.dbf
ORA-00280: change 1185078 for thread 2 is in sequence #2
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
+rac_disk/racdb/onlinelog/group_4.266.794234285 --這個不是RACDB2的current聯機日誌,其實也可以輸入歸檔。
ORA-00279: change 1185082 generated at 09/28/2012 00:40:38 needed for thread 2
ORA-00289: suggestion : +RAC_DISK/racdb/flashback/2_3_795092359.dbf
ORA-00280: change 1185082 for thread 2 is in sequence #3
ORA-00278: log file '+rac_disk/racdb/onlinelog/group_4.266.794234285' no longer
needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
+rac_disk/racdb/onlinelog/group_3.265.794234279 --這個是RACDB2的current聯機日誌
Log applied.
Media recovery complete.
總結:RAC環境下,要使用current聯機日誌時,必須要用的每個節點的聯機日誌。
(7) 開啟資料庫,以resetlogs方式。
RACDB1>alter database open resetlogs;
Database altered.
RACDB2>startup
ORACLE instance started.
Total System Global Area 184549376 bytes
Fixed Size 2019448 bytes
Variable Size 138416008 bytes
Database Buffers 41943040 bytes
Redo Buffers 2170880 bytes
Database mounted.
Database opened.
RACDB1>select count(*) from test2;
COUNT(*)
----------
11
二:用noresetlogs方法重建控制檔案
(1) 備份控制文件
RMAN> backup current controlfile;
(2) 切換日誌和運算元據
RACDB1>alter system switch logfile;
System altered.
RACDB1>create table test3 as select * from dba_data_files;
Table created.
RACDB1>alter system switch logfile;
System altered.
(3) 關閉資料庫,刪除控制檔案
RACDB1>shutdown abort
RACDB2>shutdown abort
ASMCMD> pwd
+rac_disk/racdb/controlfile
ASMCMD> ls
Current.256.795142367
ASMCMD> rm *
RACDB1>startup
ORACLE instance started.
Total System Global Area 184549376 bytes
Fixed Size 2019448 bytes
Variable Size 146804616 bytes
Database Buffers 33554432 bytes
Redo Buffers 2170880 bytes
ORA-00205: error in identifying control file, check alert log for more info
(4) 恢復控制檔案
RMAN> restore controlfile from '+RAC_DISK/racdb/backupset/2012_09_28/ncnnf0_tag20120928t015109_0.285.795145873';
RACDB1>alter database mount;
Database altered.
RACDB1>alter database backup controlfile to trace; --把控制檔案備份到trace檔案
Database altered.
(5) 重建控制檔案。
RACDB1>shutdown immediate
刪除控制檔案。
RACDB1>startup nomount;
(6) 用noresetlogs方式重建控制檔案
由於是RAC環境,所以先需要修改如下引數:
不修改引數報錯如下:
ORA-01503: CREATE CONTROLFILE failed
ORA-12720: operation requires database is in EXCLUSIVE mode
RACDB1>alter system set cluster_database=FALSE scope=spfile sid='*';
System altered.
RACDB1>shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
RACDB1>startup nomount;
ORACLE instance started.
Total System Global Area 184549376 bytes
Fixed Size 2019448 bytes
Variable Size 146804616 bytes
Database Buffers 33554432 bytes
Redo Buffers 2170880 bytes
CREATE CONTROLFILE REUSE DATABASE "RACDB" NORESETLOGS ARCHIVELOG
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 32
MAXLOGHISTORY 292
LOGFILE
GROUP 1 (
'+RAC_DISK/racdb/onlinelog/group_1.257.795091225',
'+RAC_DISK/racdb/onlinelog/group_1.295.795091229'
) SIZE 50M,
GROUP 2 '+RAC_DISK/racdb/onlinelog/group_2.258.794232619' SIZE 50M,
GROUP 3 '+RAC_DISK/racdb/onlinelog/group_3.265.794234279' SIZE 50M,
GROUP 4 '+RAC_DISK/racdb/onlinelog/group_4.266.794234285' SIZE 50M,
GROUP 5 (
'+RAC_DISK/racdb/onlinelog/group_5.269.795092365',
'+RAC_DISK/racdb/onlinelog/group_5.296.795092369'
) SIZE 100M
-- STANDBY LOGFILE
DATAFILE
'+RAC_DISK/racdb/datafile/system.259.794232627',
'+RAC_DISK/racdb/datafile/undotbs1.260.794232647',
'+RAC_DISK/racdb/datafile/sysaux.261.794232657',
'+RAC_DISK/racdb/datafile/undotbs2.263.794232675',
'+RAC_DISK/racdb/datafile/users.264.794232683'
CHARACTER SET ZHS16GBK
;
27
CREATE CONTROLFILE REUSE DATABASE "RACDB" NORESETLOGS ARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01276: Cannot add file +RAC_DISK/racdb/controlfile/current.256.795146237.
File has an Oracle Managed Files file name. -–由於使用OMF方式,所以需先在引數檔案中註釋掉controlfile。
RACDB1>show parameter control_files
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string +RAC_DISK/racdb/controlfile/cu
rrent.256.795146237
RACDB1>alter system set control_files=false scope=spfile sid='*';
System altered.
RACDB1>alter system reset control_files scope=spfile sid='*';
System altered.
RACDB1>shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
RACDB1>startup nomount;
ORACLE instance started.
Total System Global Area 184549376 bytes
Fixed Size 2019448 bytes
Variable Size 146804616 bytes
Database Buffers 33554432 bytes
Redo Buffers 2170880 bytes
RACDB1>show parameter control_files
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string /u01/app/oracle/product/10.2.0
/db_1/dbs/cntrlRACDB1.dbf
CREATE CONTROLFILE REUSE DATABASE "RACDB" NORESETLOGS ARCHIVELOG
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 32
MAXLOGHISTORY 292
LOGFILE
GROUP 1 (
'+RAC_DISK/racdb/onlinelog/group_1.257.795091225',
'+RAC_DISK/racdb/onlinelog/group_1.295.795091229'
) SIZE 50M,
GROUP 2 '+RAC_DISK/racdb/onlinelog/group_2.258.794232619' SIZE 50M,
GROUP 3 '+RAC_DISK/racdb/onlinelog/group_3.265.794234279' SIZE 50M,
GROUP 4 '+RAC_DISK/racdb/onlinelog/group_4.266.794234285' SIZE 50M,
GROUP 5 (
'+RAC_DISK/racdb/onlinelog/group_5.269.795092365',
'+RAC_DISK/racdb/onlinelog/group_5.296.795092369'
) SIZE 100M
-- STANDBY LOGFILE
DATAFILE
'+RAC_DISK/racdb/datafile/system.259.794232627',
'+RAC_DISK/racdb/datafile/undotbs1.260.794232647',
'+RAC_DISK/racdb/datafile/sysaux.261.794232657',
'+RAC_DISK/racdb/datafile/undotbs2.263.794232675',
'+RAC_DISK/racdb/datafile/users.264.794232683'
CHARACTER SET ZHS16GBK
27 ;
Control file created.
RACDB1>RACDB1>show parameter control_files
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string +RAC_DISK/racdb/controlfile/cu
rrent.256.795147383, +RAC_DISK
/racdb/controlfile/current.279
.795147383
RACDB1>alter system set cluster_database=true scope=spfile sid='*'; --勿忘
System altered.
(7) 恢復資料庫
RACDB1>recover database;
ORA-00279: change 1185480 generated at 09/28/2012 01:45:00 needed for thread 1
ORA-00289: suggestion : +RAC_DISK/racdb/flashback/1_1_795145477.dbf
ORA-00280: change 1185480 for thread 1 is in sequence #1
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
Log applied.
Media recovery complete.
(8) 開啟資料庫
RACDB1>alter database open;
Database altered.
三:用resetlogs方法重建控制檔案。此方法恢復過程和使用備份的控制檔案類似。這裡就不在敘述。最後也需要使用resetlogs方式開啟。
值得注意的是,create controlfile resetlogs/noresetlogs 這兩種重建方法的卻別在於,noresetlogs重建控制檔案時,控制檔案中datafile checkpoint來自online logs中的current log頭。而用resetlogs重建控制檔案時,控制檔案中datafile checkpoint來自各資料檔案頭。
參考至大話oracle
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31444259/viewspace-2154351/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【RMAN】如果控制檔案損壞那麼如何恢復?恢復控制檔案的方式有哪幾種?
- Oracle-無備份情況下,如何手動恢復控制檔案Oracle
- 與控制檔案有關的恢復
- 與控制檔案有關的恢復(二)
- [20210225]控制檔案序列號滿的恢復.txt
- 同名檔案替換怎麼恢復,恢復同名檔案
- 【/proc/檔案淺析】另類辦法恢復資料檔案和控制檔案
- rman恢復控制檔案的一個小錯誤
- u盤檔案變成快捷方式怎麼恢復,恢復U盤檔案的五種方法
- 記一次Oracle RAC for aix 儲存雙控鎖盤導致ASM控制檔案損壞恢復OracleAIASM
- word怎麼恢復儲存前的檔案,word檔案恢復
- 檔案替換後怎麼恢復,恢復被覆蓋的檔案
- 檔案中勒索恢復
- 剪下後的檔案可以恢復嗎?恢復剪下檔案怎麼辦?
- word自動儲存的檔案怎麼恢復,word檔案恢復
- 【BBED】丟失歸檔檔案情況下的恢復
- RAC恢復到單機
- oracle dg 歸檔日誌恢復情況Oracle
- 剪下的檔案還能恢復嗎,恢復剪貼丟失的檔案
- RAC備份恢復之Voting備份與恢復
- eclipse 恢復誤刪檔案Eclipse
- PSD檔案誤刪了怎麼恢復?教你三招
- qq檔案失效怎麼恢復 qq已失效的檔案能不能恢復
- 360粉碎檔案可以恢復嗎,如何恢復360強力刪除的檔案
- rac恢復到單例項單例
- 被格式化的硬碟檔案能恢復嗎,三步恢復格式化硬碟硬碟
- Git恢復刪除的檔案Git
- mysql 透過idb 恢復檔案MySql
- Linux恢復檔案雙手鐧Linux
- 電腦檔案恢復軟體
- uninstall 後的檔案如何恢復
- mysql 從 frm 檔案恢復 table 表結構的3種方法MySql
- oracle控制檔案的損壞或完全丟失的恢復辦法Oracle
- U盤檔案被隱藏怎麼恢復 U盤檔案恢復隱藏的方法
- Networker恢復oracle rac到單機Oracle
- 行動硬碟刪除的檔案能恢復嗎,怎麼恢復硬碟刪除的檔案硬碟
- Oracle 檔案意外刪除恢復(Linux)OracleLinux
- 隨身碟檔案被隱藏怎麼恢復 隨身碟檔案恢復隱藏的方法