控制檔案全部丟失恢復
1.1. 檢視資料庫狀態
SYS@ANING> select status from v$instance;
STATUS
------------
OPEN
1.2. 刪除全部控制檔案
SYS@ANING> !rm -rf /u01/app/oracle/oradata/ANING/disk1/control01.ctl
SYS@ANING> !rm -rf /u01/app/oracle/oradata/ANING/disk2/control02.ctl
SYS@ANING> !rm -rf /u01/app/oracle/oradata/ANING/disk3/control03.ctl
1.3. 檢查控制檔案是否存在
SYS@ANING> !ls -al /u01/app/oracle/oradata/ANING/disk1
total 1730756
drwxr-xr-x 2 oracle oinstall 4096 Dec 17 13:40 .
drwxr-xr-x 8 oracle oinstall 4096 Dec 17 13:29 ..
-rw-r----- 1 oracle oinstall 419438592 Dec 17 13:39 EXAMPLE01.dbf
-rw-r----- 1 oracle oinstall 41951232 Dec 17 13:39 INDX01.dbf
-rw-r----- 1 oracle oinstall 50339840 Dec 17 13:39 OLTP01.dbf
-rw-r----- 1 oracle oinstall 104858112 Dec 17 13:39 redo01.log
-rw-r----- 1 oracle oinstall 104858112 Dec 17 13:39 redo02.log
-rw-r----- 1 oracle oinstall 104858112 Dec 17 13:39 redo03.log
-rw-r----- 1 oracle oinstall 104858112 Dec 17 13:39 redo04_a.log
-rw-r----- 1 oracle oinstall 104858112 Dec 17 13:39 redo05_a.log
-rw-r----- 1 oracle oinstall 52436992 Dec 17 13:39 sysaux01.dbf
-rw-r----- 1 oracle oinstall 357310464 Dec 17 13:39 system01.dbf
-rw-r----- 1 oracle oinstall 20979712 Dec 14 15:16 temp01.dbf
-rw-r----- 1 oracle oinstall 10493952 Dec 15 21:04 TEMP1_01.dbf
-rw-r----- 1 oracle oinstall 10493952 Dec 14 15:34 TEMP2_01.dbf
-rw-r----- 1 oracle oinstall 50339840 Dec 17 13:39 TOOLS01.dbf
-rw-r----- 1 oracle oinstall 209723392 Dec 17 13:39 undotbs01.dbf
-rw-r----- 1 oracle oinstall 63971328 Dec 17 13:39 USERS01.dbf
SYS@ANING> !ls -al /u01/app/oracle/oradata/ANING/disk2
total 512548
drwxr-xr-x 2 oracle oinstall 4096 Dec 17 13:41 .
drwxr-xr-x 8 oracle oinstall 4096 Dec 17 13:29 ..
-rw-r----- 1 oracle oinstall 104858112 Dec 17 13:39 redo01_b.log
-rw-r----- 1 oracle oinstall 104858112 Dec 17 13:40 redo02_b.log
-rw-r----- 1 oracle oinstall 104858112 Dec 17 13:39 redo03_b.log
-rw-r----- 1 oracle oinstall 104858112 Dec 17 13:39 redo04_b.log
-rw-r----- 1 oracle oinstall 104858112 Dec 17 13:39 redo05_b.log
SYS@ANING> !ls -al /u01/app/oracle/oradata/ANING/disk3
total 12
drwxr-xr-x 2 oracle oinstall 4096 Dec 17 13:41 .
drwxr-xr-x 8 oracle oinstall 4096 Dec 17 13:29 ..
-rw-r--r-- 1 oracle oinstall 1350 Dec 14 15:52 sqlnet.log
1.4停止資料庫
SYS@ANING> shutdown abort
ORACLE instance shut down.
SYS@ANING>
1.5啟動資料庫
SYS@ANING> startup
ORACLE instance started.
Total System Global Area 314572800 bytes
Fixed Size 1219184 bytes
Variable Size 88081808 bytes
Database Buffers 222298112 bytes
Redo Buffers 2973696 bytes
ORA-00205: error in identifying control file, check alert log for more info
1.6分析錯誤資訊
檢視alert日誌
ALTER DATABASE MOUNT
Mon Dec 17 13:44:21 2012
ORA-00202: control file: '/u01/app/oracle/oradata/ANING/disk1/control01.ctl'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Mon Dec 17 13:44:21 2012
ORA-205 signalled during: ALTER DATABASE MOUNT...
從alert可以看出,很明顯是因為控制檔案丟失導致的資料庫不能mount
那我們應該如何解決呢?
alter database backup controlfile to trace這個相信大家都不陌生,在學習控制檔案結構時經常會用到。
在我們的場景下如果用呢?控制檔案全部丟失肯定是不能使用這個方法啦,但是我們可以在其他執行正常的機器上使用這個方法生成異機的trace檔案,然後根據恢復目標機的資料檔案手動建立控制檔案
1.7生成異機控制檔案trace
SYS@ANINGDBA> alter database backup controlfile to trace as '/home/oracle/ctl.ctl';
1.8選擇resetlogs,按照恢復目標機資料檔案編輯生成控制檔案的指令碼
CREATE CONTROLFILE REUSE DATABASE "ANING" RESETLOGS FORCE LOGGING ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/ANING/disk1/redo01.log' SIZE 100M,'/u01/app/oracle/oradata/ANING/disk2/redo01_b.log' SIZE 100M,
GROUP 2 '/u01/app/oracle/oradata/ANING/disk1/redo02.log' SIZE 100M,'/u01/app/oracle/oradata/ANING/disk2/redo02_b.log' SIZE 100M,
GROUP 3 '/u01/app/oracle/oradata/ANING/disk1/redo03.log' SIZE 100M,'/u01/app/oracle/oradata/ANING/disk2/redo03_b.log' SIZE 100M,
GROUP 4 '/u01/app/oracle/oradata/ANING/disk1/redo04_a.log' SIZE 100M,'/u01/app/oracle/oradata/ANING/disk2/redo04_b.log' SIZE 100M,
GROUP 5 '/u01/app/oracle/oradata/ANING/disk1/redo05_a.log' SIZE 100M,'/u01/app/oracle/oradata/ANING/disk2/redo05_b.log' SIZE 100M
DATAFILE
'/u01/app/oracle/oradata/ANING/disk1/system01.dbf',
'/u01/app/oracle/oradata/ANING/disk1/undotbs01.dbf',
'/u01/app/oracle/oradata/ANING/disk1/sysaux01.dbf',
'/u01/app/oracle/oradata/ANING/disk1/USERS01.dbf',
'/u01/app/oracle/oradata/ANING/disk1/EXAMPLE01.dbf',
'/u01/app/oracle/oradata/ANING/disk1/INDX01.dbf',
'/u01/app/oracle/oradata/ANING/disk1/OLTP01.dbf',
'/u01/app/oracle/oradata/ANING/disk1/TOOLS01.dbf'
CHARACTER SET US7ASCII
;
1.9檢視恢復目標機的狀態
SYS@ANING> select status from v$instance;
STATUS
------------
STARTED
1.10執行建立控制檔案指令碼
SYS@ANING> CREATE CONTROLFILE REUSE DATABASE "ANING" RESETLOGS FORCE LOGGING ARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 '/u01/app/oracle/oradata/ANING/disk1/redo01.log' SIZE 100M,'/u01/app/oracle/oradata/ANING/disk2/redo01_b.log' SIZE 100M,
9 GROUP 2 '/u01/app/oracle/oradata/ANING/disk1/redo02.log' SIZE 100M,'/u01/app/oracle/oradata/ANING/disk2/redo02_b.log' SIZE 100M,
10 GROUP 3 '/u01/app/oracle/oradata/ANING/disk1/redo03.log' SIZE 100M,'/u01/app/oracle/oradata/ANING/disk2/redo03_b.log' SIZE 100M,
11 GROUP 4 '/u01/app/oracle/oradata/ANING/disk1/redo04_a.log' SIZE 100M,'/u01/app/oracle/oradata/ANING/disk2/redo04_b.log' SIZE 100M,
12 GROUP 5 '/u01/app/oracle/oradata/ANING/disk1/redo05_a.log' SIZE 100M,'/u01/app/oracle/oradata/ANING/disk2/redo05_b.log' SIZE 100M
13 DATAFILE
14 '/u01/app/oracle/oradata/ANING/disk1/system01.dbf',
15 '/u01/app/oracle/oradata/ANING/disk1/undotbs01.dbf',
16 '/u01/app/oracle/oradata/ANING/disk1/sysaux01.dbf',
17 '/u01/app/oracle/oradata/ANING/disk1/USERS01.dbf',
18 '/u01/app/oracle/oradata/ANING/disk1/EXAMPLE01.dbf',
19 '/u01/app/oracle/oradata/ANING/disk1/INDX01.dbf',
20 '/u01/app/oracle/oradata/ANING/disk1/OLTP01.dbf',
21 '/u01/app/oracle/oradata/ANING/disk1/TOOLS01.dbf'
22 CHARACTER SET US7ASCII
23 ;
Control file created.
1.11使用新建立的控制檔案恢復
SYS@ANING> recover database using backup controlfile until cancel;
ORA-00279: change 219171 generated at 12/17/2012 13:39:12 needed for thread 1
ORA-00289: suggestion : /u01/app/oracle/oradata/ANING/arch/1_17_802018928.dbf
ORA-00280: change 219171 for thread 1 is in sequence #17
Specify log: {
/u01/app/oracle/oradata/ANING/disk1/redo01.log
ORA-00310: archived log contains sequence 14; sequence 17 required
ORA-00334: archived log: '/u01/app/oracle/oradata/ANING/disk1/redo01.log'
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/app/oracle/oradata/ANING/disk1/system01.dbf'
SYS@ANING> recover database using backup controlfile until cancel;
ORA-00279: change 219171 generated at 12/17/2012 13:39:12 needed for thread 1
ORA-00289: suggestion : /u01/app/oracle/oradata/ANING/arch/1_17_802018928.dbf
ORA-00280: change 219171 for thread 1 is in sequence #17
Specify log: {
/u01/app/oracle/oradata/ANING/disk1/redo02.log
Log applied.
Media recovery complete.
1.12嘗試開啟資料庫
SYS@ANING> alter database open ;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SYS@ANING> alter database open resetlogs;
Database altered.
1.13檢查資料庫狀態
SYS@ANING> select status from v$instance;
STATUS
------------
OPEN
1.14新增臨時檔案
SYS@ANING> ALTER TABLESPACE TEMPTS1 ADD TEMPFILE '/u01/app/oracle/oradata/ANING/disk1/temp01.dbf'
2 SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
Tablespace altered.
到此,我們看到手動建立控制檔案恢復成功,資料庫正常。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24558279/viewspace-753838/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 電腦檔案丟失資料恢復資料恢復
- 剪下的檔案還能恢復嗎,恢復剪貼丟失的檔案
- oracle控制檔案的損壞或完全丟失的恢復辦法Oracle
- 丟失的隨身碟檔案如何恢復?
- Sql Server資料庫檔案丟失的恢復方法SQLServer資料庫
- DATA GUARD主庫丟失資料檔案的恢復(3)
- DATA GUARD主庫丟失資料檔案的恢復(1)
- DATA GUARD主庫丟失資料檔案的恢復(2)
- 【BBED】丟失歸檔檔案情況下的恢復
- Sqlserver系統資料庫和使用者資料庫日誌檔案全部丟失的恢復SQLServer資料庫
- win10 ppt檔案丟失怎麼恢復_win10 ppt文件丟失如何找回Win10
- macOS Big Sur系統如何恢復丟失的資料檔案?Mac
- Oracle Redo丟失恢復方案Oracle
- 存放在電腦中的檔案丟失了怎麼恢復
- 伺服器資料丟失了怎麼恢復/分割槽丟失恢復教程伺服器
- dg丟失歸檔,使用rman增量備份恢復
- 【北亞資料恢復】MongoDB資料遷移檔案丟失的MongoDB資料恢復案例資料恢復MongoDB
- 【資料庫資料恢復】mdb_catalog.wt檔案丟失的MongoDB資料恢復案例資料庫資料恢復MongoDB
- 【伺服器資料恢復】xfs檔案系統資料丟失的資料恢復案例伺服器資料恢復
- 2.7.10 恢復丟失或損壞的伺服器引數檔案(SPFILE)伺服器
- 檔案丟失不用怕:超實用的Mac資料恢復軟體!Mac資料恢復
- 【資料庫資料恢復】Sql Server資料庫檔案丟失的資料恢復過程資料庫資料恢復SQLServer
- 硬碟資料丟失如何恢復?硬碟
- 分割槽丟失資料恢復資料恢復
- 【虛擬機器資料恢復】Hyper-V虛擬化檔案丟失的資料恢復案例虛擬機資料恢復
- MongoDB資料庫報錯,資料庫檔案丟失資料恢復案例MongoDB資料庫資料恢復
- wps檔案丟失如何恢復?找回只需要用到一招
- 新建的表空間(或資料檔案)丟失以及控制檔案丟失,有新建表空間(或資料檔案)前的控制文
- 與控制檔案有關的恢復
- 【RMAN】如果控制檔案損壞那麼如何恢復?恢復控制檔案的方式有哪幾種?
- 資料庫資料恢復—MongoDB資料庫檔案丟失,啟動報錯的資料恢復案例資料庫資料恢復MongoDB
- 與控制檔案有關的恢復(二)
- chkdsk 後資料丟失的恢復方法
- 伺服器RAID資料丟失恢復伺服器AI
- OMV資料恢復NAS陣列丟失資料恢復陣列
- 如何恢復伺服器資料丟失伺服器
- 伺服器資料恢復—重灌系統導致XFS檔案系統分割槽丟失的資料恢復案例伺服器資料恢復
- 【Vsan資料恢復】斷電導致Vsan分散式儲存虛擬磁碟檔案丟失的資料恢復案例資料恢復分散式
- 【伺服器資料恢復】虛擬機器檔案丟失導致Hyper-V癱瘓的資料恢復伺服器資料恢復虛擬機