控制檔案版本不一致下恢復資料庫
控制檔案跟重做日誌檔案一般都形成多路徑冗餘,區別在於日誌檔案只在日誌檔案組內
形成相互映像,而控制檔案是所有控制檔案相互形成映像。再者,控制檔案需要保持高度的
一致性,例如控制檔案的內容等,總的來說就是版本保持一致性。以下是測試控制檔案版本
不一致對資料庫的影響,進而恢復的過程:
----控制檔案的恢復:
---檢視控制檔案的資訊:
sys@PROD>col name for a50
sys@PROD>select name,status from v$controlfile;
NAME STATUS
-------------------------------------------------- -------
/u01/app/oracle/oradata/PROD/control01.ctl
/u01/app/oracle/fast_recovery_area/PROD/control02.ctl
---系統上做一個備份用於切換:
[oracle@enmo ~]$ cd /u01/app/oracle/fast_recovery_area/PROD/
[oracle@enmo PROD]$ ls
archivelog autobackup control02.ctl onlinelog
[oracle@enmo PROD]$ cp control02.ctl control02.ctl.bak
[oracle@enmo PROD]$ ls
archivelog autobackup control02.ctl control02.ctl.bak onlinelog
[oracle@enmo PROD]$
---觸發一個檢測點:
sys@PROD>alter system checkpoint;
System altered.
#從這裡已經開始導致控制檔案的版本不一致。
---刪除原來的2號控制檔案並把備份切換過來作為2號控制檔案:
[oracle@enmo PROD]$ rm control02.ctl
[oracle@enmo PROD]$ mv control02.ctl.bak control02.ctl
[oracle@enmo PROD]$
---再觸發一次檢測點:
sys@PROD>alter system checkpoint;
System altered.
---嘗試建立一個測試表:
sys@PROD>create table tests(id number(2),name varchar2(10));
create table tests(id number(2),name varchar2(10))
*
ERROR at line 1:
ORA-03135: connection lost contact
Process ID: 17656
Session ID: 1 Serial number: 7
#此時報錯,無法連線資料庫。
---嘗試關閉資料庫:
sys@PROD>shutdown immediate;
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist
sys@PROD>
---退出sqlplus重新登入並嘗試登入資料庫:
[oracle@enmo ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 22 23:01:14 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
PROD>startup
ORACLE instance started.
Total System Global Area 835104768 bytes
Fixed Size 2257840 bytes
Variable Size 507513936 bytes
Database Buffers 322961408 bytes
Redo Buffers 2371584 bytes
ORA-00214: control file '/u01/app/oracle/oradata/PROD/control01.ctl' version
4951 inconsistent with file
'/u01/app/oracle/fast_recovery_area/PROD/control02.ctl' version 4946
#此時報錯,兩個控制檔案的版本不一致。
---檢視此時例項的狀態:
PROD>select status from v$instance;
STATUS
------------
STARTED
---到作業系統層刪除2號控制檔案,並從1號控制檔案複製一份保持版本一致:
[oracle@enmo PROD]$ pwd
/u01/app/oracle/fast_recovery_area/PROD
[oracle@enmo PROD]$ rm control02.ctl
[oracle@enmo PROD]$ ls
archivelog autobackup onlinelog
[oracle@enmo PROD]$ pwd
/u01/app/oracle/oradata/PROD
[oracle@enmo PROD]$
[oracle@enmo PROD]$ cp control01.ctl /u01/app/oracle/fast_recovery_area/PROD/control02.ctl
[oracle@enmo PROD]$ pwd
/u01/app/oracle/fast_recovery_area/PROD
[oracle@enmo PROD]$ ls
archivelog autobackup control02.ctl onlinelog
#已經完成複製保持著兩個控制檔案的版本一致。
---嘗試把例項調至mount狀態:
PROD>alter database mount;
Database altered.
--alter日誌的記錄:
Tue Nov 22 23:11:34 2016
alter database mount
Tue Nov 22 23:11:38 2016
Successful mount of redo thread 1, with mount id 340427558
Database mounted in Exclusive Mode
Lost write protection disabled
Completed: alter database mount
--檢視當前例項的狀態:
PROD>select status from v$instance;
STATUS
------------
MOUNTED
#例項mount狀態。
---嘗試開啟資料庫到open狀態:
PROD>alter database open;
Database altered.
PROD>select status from v$instance;
STATUS
------------
OPEN
#資料庫已經開啟成功。
--控制檔案版本不一致的恢復也相對簡單一些,與丟失一個的恢復過程與難度相似,只是前者比後者
稍微多了一些刪除步驟,後面同樣的從一個最新版本複製一個副本到舊版本的路徑目錄下,然後在開啟資料庫。
當然,還有當全部的控制檔案丟失或者損壞的情況下,可以透過最近最新的rman控制檔案自動備份檔案恢復,
或者把控制檔案轉儲備份到trace檔案,透過trace檔案的記錄,手動重新建立控制檔案來恢復資料庫。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31392094/viewspace-2128912/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【資料庫資料恢復】EXT3檔案系統下MYSQL資料庫恢復案例資料庫資料恢復MySql
- 【資料庫資料恢復】透過恢復NDF檔案修復資料庫的資料恢復過程資料庫資料恢復
- 【資料庫資料恢復】MongoDB資料庫檔案損壞的資料恢復案例資料庫資料恢復MongoDB
- 伺服器資料恢復-ext3檔案系統下oracle資料庫資料恢復案例伺服器資料恢復Oracle資料庫
- 【資料庫資料恢復】Sql Server資料庫檔案丟失的資料恢復過程資料庫資料恢復SQLServer
- 資料庫資料恢復-SQL SERVER資料庫檔案大小變為“0”的資料恢復方案資料庫資料恢復SQLServer
- 【伺服器資料恢復】linux ext3檔案系統下mysql資料庫資料恢復案例伺服器資料恢復LinuxMySql資料庫
- 【儲存資料恢復】WAFL檔案系統下raid資料恢復案例資料恢復AI
- SQL SEVER 缺少LOG檔案資料庫恢復SQL資料庫
- 資料庫資料恢復—MongoDB資料庫檔案丟失,啟動報錯的資料恢復案例資料庫資料恢復MongoDB
- 【資料庫資料恢復】Oracle資料庫檔案出現壞塊報錯的資料恢復案例資料庫資料恢復Oracle
- 【資料庫資料恢復】windows server下SqlServer資料庫的資料恢復資料庫資料恢復WindowsServerSQL
- 【/proc/檔案淺析】另類辦法恢復資料檔案和控制檔案
- MSSQL資料庫資料恢復案例:ndf檔案大小變為0KB恢復資料SQL資料庫資料恢復
- 【資料庫資料恢復】mdb_catalog.wt檔案丟失的MongoDB資料恢復案例資料庫資料恢復MongoDB
- 【資料庫資料恢復】linux系統下MYSQL資料庫資料恢復案例資料庫資料恢復LinuxMySql
- MongoDB資料庫報錯,資料庫檔案丟失資料恢復案例MongoDB資料庫資料恢復
- 【資料庫資料恢復】LINUX EXT3檔案系統下ORACLE資料庫誤操作導致資料丟失的資料恢復案例資料庫資料恢復LinuxOracle
- 【伺服器資料恢復】reiserfs檔案系統下RAID5資料恢復案例伺服器資料恢復AI
- 【伺服器資料恢復】ZFS檔案系統下伺服器資料恢復案例伺服器資料恢復
- 【伺服器資料恢復】linux ext3檔案系統下誤刪除mysql資料庫的資料恢復案例伺服器資料恢復LinuxMySql資料庫
- Sql Server資料庫檔案丟失的恢復方法SQLServer資料庫
- 【資料庫資料恢復】SAP資料庫資料恢復案例資料庫資料恢復
- linux下恢復誤刪除oracle的資料檔案LinuxOracle
- 【伺服器資料恢復】StorNext檔案系統下raid5資料恢復過程伺服器資料恢復AI
- 【伺服器資料恢復】Zfs檔案系統下誤刪除怎麼恢復資料伺服器資料恢復
- 寶塔資料庫恢復 mysql資料庫丟失恢復 mysql資料庫刪除庫恢復 寶塔mysql資料庫恢復資料庫MySql
- 【資料庫資料恢復】LINUX環境下ORACLE資料庫誤刪除的資料恢復資料庫資料恢復LinuxOracle
- 資料恢復新姿勢——通過ibd和frm檔案恢復資料資料恢復
- 【伺服器資料恢復】StorNext檔案系統資料恢復案例伺服器資料恢復
- 【資料庫資料恢復】Sql Server資料庫資料恢復案例資料庫資料恢復SQLServer
- 與控制檔案有關的恢復
- DATA GUARD主庫丟失資料檔案的恢復(3)
- DATA GUARD主庫丟失資料檔案的恢復(1)
- DATA GUARD主庫丟失資料檔案的恢復(2)
- 【伺服器資料恢復】ext3檔案系統下Raid5資料恢復案例伺服器資料恢復AI
- 【分散式儲存資料恢復】hbase和hive資料庫底層檔案誤刪的資料恢復案例分散式資料恢復Hive資料庫
- 【RMAN】如果控制檔案損壞那麼如何恢復?恢復控制檔案的方式有哪幾種?
- 如何恢復在全備後新增了資料檔案的資料庫資料庫