中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

RAC控制文件恢復的三種不同情況分別是什么

發布時間:2021-11-09 16:50:53 來源:億速云 閱讀:122 作者:柒染 欄目:建站服務器

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來自各數據文件頭。

關于RAC控制文件恢復的三種不同情況分別是什么問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業資訊頻道了解更多相關知識。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

rac
AI

五峰| 巍山| 淮安市| 黄平县| 红河县| 紫金县| 浑源县| 阳城县| 梁河县| 黎川县| 佛教| 舞钢市| 苗栗县| 昆山市| 呈贡县| 桦甸市| 根河市| 青阳县| 卢氏县| 平南县| 福泉市| 盐源县| 隆安县| 六枝特区| 乌鲁木齐县| 通化县| 河间市| 苏尼特右旗| 桦川县| 西乌珠穆沁旗| 沙坪坝区| 修武县| 淮北市| 阜康市| 祁门县| 健康| 重庆市| 南溪县| 建德市| 巧家县| 张北县|