oracle 修改 dbid,Oracle HowTo:如何获得数据库的DBID

3.从自动备份中恢复

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

[oracle@jumper dbs]$ rman target  /

Recovery Manager: Release 9.2.0.4.0 - Production

Copyright (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-06

using target database controlfile instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=11 devtype=DISK

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

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

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

RMAN-03002: failure of restore command at 02/05/2006 20:47:25

RMAN-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-06

using channel ORA_DISK_1

channel ORA_DISK_1: restoring controlfile

channel ORA_DISK_1: restore complete

replicating controlfile

input filename=/opt/oracle/oradata/conner/control01.ctl

output filename=/opt/oracle/oradata/conner/control02.ctl

output filename=/opt/oracle/oradata/conner/control03.ctl

Finished restore at 05-FEB-06

4.直接从幸存的文件中读取

由于DBID存在于数据文件及控制文件中,所以我们可以通过PL/SQL程序直接从文件中读取:

SQL> select eygle.get_dbid('/opt/oracle/oradata/conner','user02.dbf') from dual;

EYGLE.GET_DBID('/OPT/ORACLE/OR

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

3152029224

SQL> select dbid from v$database;

DBID

----------

3152029224 其实更简单的,用BBED就好了。

这种方法仅为测试兴趣所致,不被推荐.

相关文章参考:

历史上的今天...

>>

2018-02-05文章:

2011-02-05文章:

2010-02-05文章:

2009-02-05文章:

2008-02-05文章:

2007-02-05文章:

2005-02-05文章:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值