探索Oracle之RMAN_07 磁碟損壞資料丟失恢複

來源:互聯網
上載者:User

有的時候在企業裡面難免會出現由於磁碟損壞而導致資料庫的故障乃至資料的丟失,那麼這個時候,那麼這個時候資料的備份就顯得尤為的重要。在這一節我們重點討論下由於裝載資料檔案,redo記錄檔,controlfile控制檔案的磁碟損壞的資料恢複。 

6.1 通過強制卸載磁碟類比資料磁碟損壞:

[root@wwldb ~]# umount -f /DBData/

umount2: 資源或裝置忙

umount: /DBData: device is busy

umount2: 資源或裝置忙

umount: /DBData: device is busy

 

[root@wwldb ~]# fuser -m -k /DBData/     查看裝置佔用情況

/DBData/: 3508 3510  3512  3514 3516  3518  3529 3531  3535  3541 3610c

 

[root@wwldb ~]# fuser -m -k -i -k /DBData/   強制kill  /DBData相關進程

[root@wwldb ~]# umount -f /DBData/       卸載/DBData

[root@wwldb ~]#

 

6.2 umount 後,通過alert看到執行個體也隨之宕機了。

Fri Jul  616:03:33 2012

Errors in file/DBSoft/admin/WWL/bdump/wwl_pmon_3502.trc:

ORA-00471: DBWR process terminated with error

Fri Jul  616:03:33 2012

PMON: terminating instance due to error 471

Instance terminated by PMON, pid = 3502

 

[root@wwldb bdump]# ps -ef|grep ora

root     2965  2943  0 14:39 ?        00:00:00 hald-addon-storage: polling/dev/hdc

root     3944  3050  0 16:07 pts/2    00:00:00 su - Oracle

oracle   3945  3944  0 16:07 pts/2    00:00:00 -bash

oracle   3977  3945  0 16:07 pts/2    00:00:00 rlwrap sqlplus / as sysdba

oracle   3978  3977  0 16:07 pts/3    00:00:00 sqlplus   as sysdba

oracle   3979  3978  0 16:07 ?        00:00:00 oracleWWL(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

root     4022  3980  0 16:10 pts/4    00:00:00 grep ora

[root@wwldb bdump]#

 

6.3 要恢複首先要將資料庫啟動到mount狀態才能恢複

SQL> startup

ORACLE instance started.

 

Total System Global Area  100663296 bytes

Fixed Size                  1217884 bytes

Variable Size              88083108 bytes

Database Buffers            8388608 bytes

Redo Buffers               2973696 bytes

ORA-00205: error in identifying control file, checkalert log for more info

 

資料庫無法啟動到mount狀態,要執行恢複必須啟動到mount狀態下才能執行,不過我們在alert日誌裡面看到是因為確實控制檔案2資料庫無法啟動到mount狀態,見如下:

Fri Jul  616:13:24 2012

ORA-00202: control file:'/DBData/oradata/WWL/control02.ctl'

ORA-27037: unable to obtain file status

Linux Error: 2: No such file or directory

Additional information: 3

Fri Jul  616:13:24 2012

ORA-205 signalled during: ALTER DATABASE   MOUNT...

 

這個時候我們可以嘗試尋找其它控制檔案是否都存在,存放在哪裡,只要存在任何一個控制檔案我們只需要修改參數檔案來達到將資料庫啟動到mount狀態。

 

SQL> show parameter control

 

NAME                                 TYPE        VALUE

----------------------------------------------- ------------------------------

control_file_record_keep_time        integer     7

control_files                        string      /DBSoft/oradata/WWL/control01.ctl, /DBData/oradata/WWL/control02.ctl, /DBData/oradata/WWL/control03.ctl

 

我們通過spfile參數可以看到控制檔案是存放在兩塊磁碟上,損壞的磁碟為/DBData,那麼也就以為著control02.ctl和control03.ctl兩個控制檔案損壞,這個時候我們可以通過/DBSoft磁碟上的control01.ctl來啟動資料庫,或者將control02.ctl和control03通過control01.ctl轉儲到其它磁碟上來啟動資料庫。

 

我現在通過修改參數檔案僅保留control01.ctl來啟動資料庫。

 

SQL> alter system set control_files ='/DBSoft/oradata/WWL/control01.ctl' scope=spfile;

System altered.

 

SQL> shutdown immediate

ORA-01507: database not mounted

ORACLE instance shut down.

 

SQL> startup mount;

ORACLE instance started.

 

Total System Global Area  100663296 bytes

Fixed Size                  1217884 bytes

Variable Size              88083108 bytes

Database Buffers            8388608 bytes

Redo Buffers                2973696 bytes

Database mounted.

SQL>

我們可以看到通過修改參數檔案,現在資料庫已經啟動到mount狀態。

  • 1
  • 2
  • 3
  • 4
  • 下一頁

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.