控制檔案損壞處理
二、有 rman 備份的恢復
2.1 只損壞一個控制檔案的情況
本文件的恢復場景都是針對的多控制檔案的情況,如果你只有一個那當我沒說 😄 。
檢視控制檔案
SQL> show parameter control_files; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_files string /oracle/app/oradata/orcl/control01.ctl, /oracle/app/oradata/orcl/control02.ctl
模擬破壞
[oracle@redhat11g8 orcl]$ echo ''>/oracle/app/oradata/orcl/control01.ctl
後臺日誌可以看到會報控制檔案有壞塊,但是例項還沒有宕:
Errors in file /oracle/app/diag/rdbms/orcl/orcl/trace/orcl_ckpt_30033.trc (incident=38401): ORA-00227: corrupt block detected in control file: (block 1, # blocks 1) ORA-00202: control file: '/oracle/app/oradata/orcl/control01.ctl'
做一次檢查點切換:
SQL> alter system checkpoint; alter system checkpoint * ERROR at line 1: ORA-03113: end-of-file on communication channel Process ID: 26789 Session ID: 153 Serial number: 2627
後臺日誌顯示例項被異常終止:
CKPT (ospid: 30033): terminating the instance due to error 227 Wed Feb 13 08:20:11 2019 System state dump requested by (instance=1, osid=30033 (CKPT)), summary=[abnormal instance termination]. System State dumped to trace file /oracle/app/diag/rdbms/orcl/orcl/trace/orcl_diag_30021_20190213082011.trc Dumping diagnostic data in directory=[cdmp_20190213082011], requested by (instance=1, osid=30033 (CKPT)), summary=[abnormal instance termination]. Instance terminated by CKPT, pid = 30033
恢復方法:
cp control02.ctl control01.ctl
然後重新 startup 例項,執行正常。
2.2 所有控制檔案都損壞的情況
模擬破壞:
[oracle@redhat11g8 orcl]$ echo ''>control01.ctl [oracle@redhat11g8 orcl]$ echo ''>control02.ctl SQL> alter system checkpoint; alter system checkpoint * ERROR at line 1: ORA-03113: end-of-file on communication channel Process ID: 26927 Session ID: 135 Serial number: 13
後臺日誌情況和前面一樣在發生檢查點切換後,例項就宕了。
恢復方法:
RMAN> restore controlfile from '/home/oracle/rman/full_08tpot0t_1_1'; Starting restore at 13-FEB-19 using channel ORA_DISK_1 channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 output file name=/oracle/app/oradata/orcl/control01.ctl output file name=/oracle/app/oradata/orcl/control02.ctl Finished restore at 13-FEB-19 RMAN> recover database;//對控制檔案進行歸檔+redo恢復 RMAN> alter database open resetlogs; database opened
三、沒有 rman 備份的恢復
[oracle@redhat11g8 orcl]$ echo ''>control01.ctl [oracle@redhat11g8 orcl]$ echo ''>control02.ctl [oracle@redhat11g8 orcl]$ !sql sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Wed Feb 13 08:59:38 2019 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> alter system checkpoint; alter system checkpoint * ERROR at line 1: ORA-03113: end-of-file on communication channel Process ID: 27123 Session ID: 72 Serial number: 3
恢復方法,若是還能 mount 的話倒簡單,
alter database backup controlfile to trace as '/tmp/ctl.txt';
即可,如果不能
mount
的話,只能麻煩點恢復:
透過引數檔案獲取資料庫名:
SQL> startup nomount; ORACLE instance started. Total System Global Area 2471931904 bytes Fixed Size 2255752 bytes Variable Size 620758136 bytes Database Buffers 1845493760 bytes Redo Buffers 3424256 bytes SQL> create pfile='/tmp/orcl.ora' from spfile; File created. *.db_name='orcl'
查詢字符集:
SQL> select userenv('language') from dual; USERENV('LANGUAGE') ---------------------------------------------------- AMERICAN_AMERICA.US7ASCII
獲取資料檔名和 redo 檔名:
[oracle@redhat11g8 orcl]$ ls -lh *.dbf -rw-r-----. 1 oracle oinstall 254M Feb 13 08:54 jason01.dbf -rw-r-----. 1 oracle oinstall 101M Feb 13 08:54 odc01.dbf -rw-r-----. 1 oracle oinstall 1.3G Feb 13 08:54 sysaux01.dbf -rw-r-----. 1 oracle oinstall 781M Feb 13 08:54 system01.dbf -rw-r-----. 1 oracle oinstall 9.9G Feb 13 08:54 temp01.dbf -rw-r-----. 1 oracle oinstall 11M Feb 3 06:50 temp02.dbf -rw-r-----. 1 oracle oinstall 2.6G Feb 13 08:54 test.dbf -rw-r-----. 1 oracle oinstall 1.9G Feb 13 08:54 undotbs01.dbf -rw-r-----. 1 oracle oinstall 11G Feb 13 08:54 users01.dbf [oracle@redhat11g8 orcl]$ ls -lh *.log -rw-r-----. 1 oracle oinstall 51M Feb 13 08:54 redo01.log -rw-r-----. 1 oracle oinstall 51M Feb 13 08:54 redo02.log -rw-r-----. 1 oracle oinstall 51M Feb 13 08:59 redo03.log
編寫重建指令碼 ( 注意臨時檔案不要寫進重建指令碼里,不然會報如下錯誤 ) :
ERROR at line 1: ORA-01503: CREATE CONTROLFILE failed ORA-01160: file is not a data file ORA-01110: data file : '/oracle/app/oradata/orcl/temp01.dbf'
CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 '/oracle/app/oradata/orcl/redo01.log' SIZE 50M BLOCKSIZE 512, GROUP 2 '/oracle/app/oradata/orcl/redo02.log' SIZE 50M BLOCKSIZE 512, GROUP 3 '/oracle/app/oradata/orcl/redo03.log' SIZE 50M BLOCKSIZE 512 -- STANDBY LOGFILE DATAFILE '/oracle/app/oradata/orcl/jason01.dbf', '/oracle/app/oradata/orcl/odc01.dbf', '/oracle/app/oradata/orcl/sysaux01.dbf', '/oracle/app/oradata/orcl/system01.dbf', '/oracle/app/oradata/orcl/test.dbf', '/oracle/app/oradata/orcl/undotbs01.dbf', '/oracle/app/oradata/orcl/users01.dbf' CHARACTER SET US7ASCII ; SQL> alter database open resetlogs;
Database altered.
四、注意事項
1 、除了 2.1 這種透過 cp 另一個控制檔案恢復的情景,其他情景都需要在恢復完後做一個 RMAN 全備份,因為 resetlogs 開啟後,之前的備份片都會失效。
2 、控制檔案最好能做冗餘,就算壞了一個,還可以用另一個恢復。
來自 “ ITPUB部落格 ” ,連結:https://blog.itpub.net/70013625/viewspace-3011925/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 一個控制檔案損壞
- 陣列櫃故障造成控制檔案損壞,資料檔案損壞陣列
- sysaux表空間檔案損壞的處理(zt)UX
- 處理塊損壞
- Oracle 控制檔案損壞解決方案Oracle
- 損壞控制檔案的恢復方法
- 控制檔案損壞重建實驗(上)
- 控制檔案損壞重建實驗(下)
- Oracle 無備份情況下undo檔案損壞處理Oracle
- coreldraw檔案丟失(損壞)的恢復處理辦法
- 恢復之單個控制檔案損壞
- 單個控制檔案損壞的恢復
- SQL Server 2005日誌檔案損壞的處理方法SQLServer
- 前線上日誌檔案損壞與ora-600 [4000]處理
- undo 檔案損壞
- 控制檔案損壞,丟失其中一個
- 某個控制檔案損壞的恢復案例
- 單個控制檔案損壞的解決方法
- 一次控制檔案損壞的恢復
- 段頭損壞的處理
- Oracle聯機日誌檔案丟失或損壞的處理方法Oracle
- 備份&恢復之十三:損壞全部控制檔案
- 所有控制檔案損壞的恢復--resetlogs方式
- 所有控制檔案損壞的恢復--noresetlogs方式
- 第7章 處理塊損壞
- ORACLE聯機日誌檔案丟失或損壞的處理方法(轉)Oracle
- Oracle聯機日誌檔案丟失或損壞的處理方法 (轉)Oracle
- oracle10g rac 表決盤損壞、ocr損壞處理Oracle
- 控制檔案損壞恢復(20100402)
- 備份&恢復之十二:損壞單個控制檔案
- RMAN出現檔案損壞ORA-19566: exceeded limit of 0 corrupt blocks 處理MITBloC
- RAC磁碟頭損壞問題處理
- UNDO表空間損壞的處理
- 一次控制檔案損壞後的恢復經歷
- rman執行與控制檔案損壞_loss_小測試
- 控制檔案丟失處理方法
- undo檔案丟失或損壞
- 資料檔案損壞、丟失
- oracle - redo 損壞或刪除處理方法Oracle