ITPub博客

首页 > 数据库 > Oracle > 【RMAN】利用备份片还原数据库(中)-附加

【RMAN】利用备份片还原数据库(中)-附加

Oracle 作者:Appleses 时间:2016-01-30 16:47:36 0 删除 编辑

 

直接通过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版:http://yunpan.cn/QCwUAI9bn7g7w  提取码:af2d

QQ:642808185 注明:ITPUB的文章标题

<版权所有,文章允许转载,但须以链接方式注明源地址,否则追究法律责任!>

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

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28628435/viewspace-1984451/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论