控制檔案備份增加、破壞恢復系列實驗(下)

realkid4發表於2011-07-02

 

4、修復control_file錯誤

 

Control_files定義的控制檔案列表中,採用的是多路備份方式。所以在內容上,所有的檔案都是一樣的。使用作業系統層面上的複製貼上方式,恢復出備份。

 

 

//嘗試恢復

 

[oracle@oracle11g trace]$ cd /u01/oradata/WILSON/controlfile/

[oracle@oracle11g controlfile]$ pwd

/u01/oradata/WILSON/controlfile

[oracle@oracle11g controlfile]$ ls -l

total 19072

-rw-r-----  1 oracle oinstall 9748480 Jun 30 15:27 o1_mf_6bcsqm50_.ctl

-rw-r-----  1 oracle oinstall 9748480 Jun 30 15:27 o2bak.ctl

[oracle@oracle11g controlfile]$

 

[oracle@oracle11g controlfile]$ cp o1_mf_6bcsqm50_.ctl o2.ctl

[oracle@oracle11g controlfile]$ ls -l

total 28608

-rw-r-----  1 oracle oinstall 9748480 Jun 30 15:27 o1_mf_6bcsqm50_.ctl

-rw-r-----  1 oracle oinstall 9748480 Jun 30 15:27 o2bak.ctl

-rw-r-----  1 oracle oinstall 9748480 Jun 30 15:31 o2.ctl

 

 

再次檢視啟動資料庫。

 

 

[oracle@oracle11g controlfile]$ sqlplus /nolog

 

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 30 15:31:55 2011

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

SQL> conn / as sysdba

Connected.

SQL> startup

ORA-01081: cannot start already-running ORACLE - shut it down first

SQL> shutdown abort

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

 

Total System Global Area  414298112 bytes

Fixed Size                  1336904 bytes

Variable Size             318769592 bytes

Database Buffers           88080384 bytes

Redo Buffers                6111232 bytes

Database mounted.

Database opened.

SQL>

 

 

啟動成功。

 

5、恢復原有control_files引數

 

最後我們恢復實驗環境,提出o2.ctl的控制檔案身份。

 

 

//處理掉原來的檔案

SQL> show parameter control_files;

 

NAME                                 TYPE        VALUE

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

control_files                        string      /u01/oradata/WILSON/controlfile/o1_mf_6bcsqm50_.ctl, /u01/flash_recovery_area/WILSON/controlfile/o1_mf_6bcsqmd8_.ctl, /u01/oradata/WILSON/controlfile/o2.ctl

 

 

SQL> alter system set control_files='/u01/oradata/WILSON/controlfile/o1_mf_6bcsqm50_.ctl', '/u01/flash_recovery_area/WILSON/controlfile/o1_mf_6bcsqmd8_.ctl' scope=spfile;

 

System altered

 

 

之後,重新啟動資料庫即可成效。

 

 

[oracle@oracle11g controlfile]$ sqlplus /nolog

 

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 30 15:35:57 2011

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

SQL> conn / as sysdba

Connected.

SQL> shutdown abort

ORACLE instance shut down.

SQL>

 

 

[oracle@oracle11g controlfile]$ ls -l

total 28608

-rw-r-----  1 oracle oinstall 9748480 Jun 30 15:35 o1_mf_6bcsqm50_.ctl

-rw-r-----  1 oracle oinstall 9748480 Jun 30 15:27 o2bak.ctl

-rw-r-----  1 oracle oinstall 9748480 Jun 30 15:35 o2.ctl

[oracle@oracle11g controlfile]$ rm o2.ctl

[oracle@oracle11g controlfile]$ ls -l

total 19072

-rw-r-----  1 oracle oinstall 9748480 Jun 30 15:35 o1_mf_6bcsqm50_.ctl

-rw-r-----  1 oracle oinstall 9748480 Jun 30 15:27 o2bak.ctl

 

//重新啟動

[oracle@oracle11g controlfile]$ sqlplus /nolog

 

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 30 15:36:26 2011

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

SQL> conn / as sysdba

Connected to an idle instance.

SQL> startup

ORACLE instance started.

 

Total System Global Area  414298112 bytes

Fixed Size                  1336904 bytes

Variable Size             318769592 bytes

Database Buffers           88080384 bytes

Redo Buffers                6111232 bytes

Database mounted.

Database opened.

 

 

SQL> show parameter control_files;

NAME                                 TYPE        VALUE

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

control_files                        string      /u01/oradata/WILSON/controlfil

                                                 e/o1_mf_6bcsqm50_.ctl, /u01/fl

                                                 ash_recovery_area/WILSON/contr

                                                 olfile/o1_mf_6bcsqmd8_.ctl

 

 

6、結論

 

Control_file的多路備份,可以減少由於硬體原因引起的資料庫致命傷害。控制檔案中包括了一些核心資料資訊,進行操作一定要小心。

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17203031/viewspace-701210/,如需轉載,請註明出處,否則將追究法律責任。

相關文章