探索Oracle不完全恢複之--基於備份控制檔案恢複

來源:互聯網
上載者:User

基於備份控制檔案(unsing backup controlfile)的恢複

主要適用於:基於備份控制檔案的恢複只要適用於以下情況:資料表空間被意外刪除;所有控制檔案全部損壞。

 

1、關閉資料庫執行一次全庫冷備份:

SQL> select file_name from dba_data_files;

 

FILE_NAME

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

/DBBak2/oradata/WWL/users01.dbf

/DBBak2/oradata/WWL/sysaux01.dbf

/DBBak2/oradata/WWL/undotbs01.dbf

/DBBak2/oradata/WWL/system01.dbf

/DBBak2/oradata/WWL/WWL001.dbf

/DBBak2/oradata/WWL/WWL002.dbf

/DBBak2/oradata/WWL/WWL003.dbf

 

7 rowsselected.

 

SQL> shutdown immediate

Databaseclosed.

Databasedismounted.

Oracleinstance shut down.

 

SQL> !mkdir /DBBak2/oradata/WWL2

 

SQL> !cp /DBBak2/oradata/WWL/* /DBBak2/oradata/WWL2/

 

通過如上的操作資料庫現在已經有了一個冷備份了,裡麵包含另外wwl資料表空間,現在類比使用者誤刪除了wwl資料表空間。

 

SQL> startup

ORACLEinstance started.

TotalSystem Global Area  100663296 bytes

FixedSize                  1217884 bytes

VariableSize              88083108 bytes

DatabaseBuffers            8388608 bytes

RedoBuffers                2973696 bytes

Databasemounted.

Databaseopened.

SQL>

 

類比刪除資料表空間

SQL> drop tablespace wwl including contents;

Tablespacedropped.

 

    當前的控制檔案中已經不包含wwl資料表空間了,但是我們之前冷備份的控制檔案中還是包含的,所以必須使用以前的控制檔案來進行wwl資料表空間的恢複。

 

還原之前備份的資料檔案:

SQL> shutdown immediate

Databaseclosed.

Databasedismounted.

ORACLEinstance shut down.

 

 

SQL> !rm -rf /DBBak2/oradata/WWL/*.dbf

 

SQL> !rm -rf /DBBak2/oradata/WWL/*.ctl

 

SQL> !cp /DBBak2/oradata/WWL2/*.dbf /DBBak2/oradata/WWL/

 

SQL> !cp /DBBak2/oradata/WWL2/*.ctl /DBBak2/oradata/WWL/

 

SQL> 

 

使用控制檔案進行恢複:

SQL> startup

ORACLEinstance started.

 

TotalSystem Global Area  100663296 bytes

FixedSize                  1217884 bytes

VariableSize              88083108 bytes

DatabaseBuffers            8388608 bytes

RedoBuffers                2973696 bytes

Databasemounted.

ORA-00338:log 5 of thread 1 is more recent than control file

ORA-00312:online log 5 thread 1: '/DBBak2/oradata/WWL/redo5a.log'

ORA-00312:online log 5 thread 1: '/DBBak2/oradata/WWL/redo5b.log'

 

 

SQL> recover database using backup controlfile until cancel;

ORA-00279:change 1782560 generated at 07/31/2012 14:37:24 needed for thread 1

ORA-00289:suggestion : /DBSoft/product/10.2.0/db_1/dbs/arch/1_3_790085314.dbf

ORA-00280:change 1782560 for thread 1 is in sequence #3

 

 

Specifylog: {<RET>=suggested | filename | AUTO | CANCEL}

cancel

Mediarecovery cancelled.

 

SQL> alter database open resetlogs;

 

Databasealtered.

 

SQL>

 

至此已經恢複成功。

相關閱讀:

探索Oracle之RMAN_01概念

探索Oracle之RMAN_02基本使用

探索Oracle之RMAN_03非一致性備份

探索Oracle之RMAN_04非一致性備份

探索Oracle之RMAN_05增量備份

探索Oracle之RMAN_06備份策略

探索Oracle之RMAN_07單個資料檔案丟失恢複

探索Oracle之RMAN_07整個業務資料表空間丟失恢複

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

探索Oracle之RMAN_07 資料庫所有檔案全部丟失恢複

探索Oracle之RMAN_07 重做日誌redu檔案丟失恢複

探索Oracle之RMAN_07 參數檔案丟失恢複

探索Oracle之RMAN_07控制檔案丟失恢複

探索Oracle之RMAN_07 system資料表空間丟失恢複

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.