免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1094 | 回复: 0
打印 上一主题 下一主题

数据库恢复过程中获取DBID [复制链接]

招聘 : 研发工程师
论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-12-21 08:44 |只看该作者 |倒序浏览

1.查询v$database获得

由于DBID在控制文件和数据文件中都存在记录,所以如果能够mount数据库就可以查询v$database视图获得.

SQL> select dbid,name from v$database;

      DBID NAME
---------- ---------
1860154963 KEN

2.在nomount状态时

如果数据库配置了自动控制文件备份(Oracle9i),并且名称是缺省的,那么我们可以从自动备份文件获得DBID.

[oracle@jumper dbs]$ cd $ORACLE_HOME/dbs[oracle@jumper dbs]$ ll c-*-rw-r----- 1 oracle dba 3375104 Dec 21 11:13 c-3152029224-20051221-00-rw-r----- 1 oracle dba 3358720 Jan 21 14:03 c-3152029224-20060121-00-rw-r----- 1 oracle dba 3358720 Jan 21 14:08 c-3152029224-20060121-01

这里的3152029224就是DBID.

3.从自动备份中恢复

需要或缺DBID进行恢复通常是因为丢失了所有的控制文件.在恢复时会遇到错误.

[oracle@jumper dbs]$ rman target /Recovery Manager: Release 9.2.0.4.0 - ProductionCopyright (c) 1995, 2002, Oracle Corporation. All rights reserved.connected to target database: conner (not mounted)RMAN> restore controlfile from autobackup;Starting restore at 05-FEB-06using target database controlfile instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: sid=11 devtype=DISKRMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of restore command at 02/05/2006 20:47:25RMAN-06495: must explicitly specify DBID with SET DBID command

如果存在自动备份,我们通常可以直接恢复控制文件,mount数据库之后就好办了:

RMAN> restore controlfile from '/opt/oracle/product/9.2.0/dbs/c-3152029224-20051221-00';Starting restore at 05-FEB-06using channel ORA_DISK_1channel ORA_DISK_1: restoring controlfilechannel ORA_DISK_1: restore completereplicating controlfileinput filename=/opt/oracle/oradata/conner/control01.ctloutput filename=/opt/oracle/oradata/conner/control02.ctloutput filename=/opt/oracle/oradata/conner/control03.ctlFinished restore at 05-FEB-06

4.直接从RMAN连接的时候显示

[oracle@ken ~]$ rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on Fri May 6 11:08:09 2011

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

connected to target database: KEN (DBID=1860154963)
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP