【RMAN】利用備份片還原資料庫(中)-附加

Appleses發表於2016-01-30

 

直接透過rman的restore命令來嘗試判斷備份集中是否含有控制檔案的備份

 

相關文章連結:

【RMAN】利用備份片還原資料庫(上): http://blog.itpub.net/26736162/viewspace-1621581/

【RMAN】利用備份片還原資料庫(中):http://blog.itpub.net/26736162/viewspace-1621661/

【RMAN】利用備份片還原資料庫(下):http://blog.itpub.net/26736162/viewspace-1621672/

 

前邊的3篇blog中介紹了,在只剩下一些備份片的情況下如何從這些僅剩的備份片中判斷是否有控制檔案的備份並還原整個資料庫,我們介紹了2種① 推薦: 採用dbms_backup_restore.restoreControlfileTo從備份片中來嘗試找回控制檔案 ②   嘗試採用建立臨時庫來找回控制檔案 ③ 採用作業系統命令的strings來判斷(私聊) ,今天我們來看看如何直接透過rman的restore命令來嘗試判斷備份集中是否含有控制檔案的備份,這也是一種推薦的方法。

 

 

    假設,現在我們只有下邊的4個備份片段,不知道dbid和db_name,如果db_name不知道的話,可以任意指定一個例項名,然後嘗試從rman來啟動到nomount,這個時候會啟動預設的DUMMY資料庫,然後從各個備份集中來嘗試恢復控制檔案,如果控制檔案不在備份集中那麼就只能重建控制檔案了,參考 http://blog.itpub.net/26736162/viewspace-1621672/

 

[oracle@orcltest ~]$ cd /tmp/2015_05_02/

[oracle@orcltest 2015_05_02]$ ll

total 1161972

-rw-r----- 1 oracle oinstall   10125312 May  4 14:23 01q63iof_1_1

-rw-r----- 1 oracle oinstall   31271424 May  2 15:49 o1_mf_annnn_TAG20150502T154402_bn9022tb_.bkp

-rw-r----- 1 oracle oinstall       4096 May  2 15:49 o1_mf_annnn_TAG20150502T154451_bn903mln_.bkp

-rw-r----- 1 oracle oinstall 1148452864 May  2 15:49 o1_mf_nnndf_TAG20150502T154404_bn9025w1_.bkp

[oracle@orcltest 2015_05_02]$

[oracle@orcltest ~]$ ORACLE_SID=TEST

[oracle@orcltest ~]$ rman target /

 

Recovery Manager: Release 11.2.0.1.0 - Production on Mon May 4 14:27:00 2015

 

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

 

connected to target database (not started)

 

RMAN> startup nomount;

 

startup failed: ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initTEST.ora'

 

starting Oracle instance without parameter file for retrieval of spfile

Oracle instance started

 

Total System Global Area     158662656 bytes

 

Fixed Size                     2211448 bytes

Variable Size                 92275080 bytes

Database Buffers              58720256 bytes

Redo Buffers                   5455872 bytes

 

RMAN>  restore  controlfile from '/tmp/2015_05_02/o1_mf_annnn_TAG20150502T154402_bn9022tb_.bkp';

 

Starting restore at 2015-05-04 14:28:03

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=87 device type=DISK

 

channel ORA_DISK_1: restoring control file

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 05/04/2015 14:28:04

ORA-19870: error while restoring backup piece /tmp/2015_05_02/o1_mf_annnn_TAG20150502T154402_bn9022tb_.bkp

ORA-19626: backup set type is archived log - can not be processed by this conversation

 

RMAN>  restore  controlfile from '/tmp/2015_05_02/o1_mf_annnn_TAG20150502T154451_bn903mln_.bkp';

 

Starting restore at 2015-05-04 14:28:20

using channel ORA_DISK_1

 

channel ORA_DISK_1: restoring control file

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 05/04/2015 14:28:20

ORA-19870: error while restoring backup piece /tmp/2015_05_02/o1_mf_annnn_TAG20150502T154451_bn903mln_.bkp

ORA-19626: backup set type is archived log - can not be processed by this conversation

 

RMAN>  restore  controlfile from '/tmp/2015_05_02/o1_mf_nnndf_TAG20150502T154404_bn9025w1_.bkp';

 

Starting restore at 2015-05-04 14:28:33

using channel ORA_DISK_1

 

channel ORA_DISK_1: restoring control file

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 05/04/2015 14:28:34

ORA-19697: standby control file not found in backup set

 

RMAN>  restore  controlfile from '/tmp/2015_05_02/01q63iof_1_1';

 

Starting restore at 2015-05-04 14:28:59

using channel ORA_DISK_1

 

channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/cntrlTEST.dbf

Finished restore at 2015-05-04 14:29:00

 

RMAN> alter database mount;

 

using target database control file instead of recovery catalog

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of alter db command at 05/04/2015 14:44:38

ORA-01103: database name 'ORA11G' in control file is not 'DUMMY'

 

RMAN> exit

 

 

Recovery Manager complete.

[oracle@orcltest ~]$

[oracle@orcltest ~]$ rman target /

 

Recovery Manager: Release 11.2.0.1.0 - Production on Mon May 4 14:44:21 2015

 

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

 

connected to target database: DUMMY (not mounted)

 

RMAN> exit

 

 

Recovery Manager complete.

[oracle@orcltest ~]$ ps -ef|grep ora_

oracle   25153     1  0 14:27 ?        00:00:00 ora_pmon_TEST

oracle   25155     1  0 14:27 ?        00:00:00 ora_vktm_TEST

oracle   25159     1  0 14:27 ?        00:00:00 ora_gen0_TEST

oracle   25161     1  0 14:27 ?        00:00:00 ora_diag_TEST

oracle   25163     1  0 14:27 ?        00:00:00 ora_dbrm_TEST

oracle   25165     1  0 14:27 ?        00:00:00 ora_psp0_TEST

oracle   25167     1  0 14:27 ?        00:00:00 ora_dia0_TEST

oracle   25169     1  0 14:27 ?        00:00:00 ora_mman_TEST

oracle   25171     1  0 14:27 ?        00:00:00 ora_dbw0_TEST

oracle   25173     1  0 14:27 ?        00:00:00 ora_lgwr_TEST

oracle   25175     1  0 14:27 ?        00:00:00 ora_ckpt_TEST

oracle   25177     1  0 14:27 ?        00:00:00 ora_smon_TEST

oracle   25179     1  0 14:27 ?        00:00:00 ora_reco_TEST

oracle   25181     1  0 14:27 ?        00:00:00 ora_mmon_TEST

oracle   25183     1  0 14:27 ?        00:00:00 ora_mmnl_TEST

oracle   25255 25216  0 14:46 pts/3    00:00:00 grep ora_

[oracle@orcltest ~]$

 

 

嘗試的過程中可以看到,能識別出是不是歸檔檔案的備份集,是不是資料檔案的備份集,最後mount的時候還可以識別出控制檔案中記錄的db_name,如果包含控制檔案的話,就可以直接來恢復控制檔案了,控制檔案恢復了其他恢復都很簡單了。

 

...........................................................................................................................................................................................

本文作者:小麥苗,只專注於資料庫的技術,更注重技術的運用

ITPUB BLOG:http://blog.itpub.net/26736162

本文地址:http://blog.itpub.net/26736162/viewspace-1621938/

本文pdf版:  提取碼:af2d

QQ:642808185 註明:ITPUB的文章標題

<版權所有,文章允許轉載,但須以連結方式註明源地址,否則追究法律責任!>

...........................................................................................................................................................................................

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

相關文章