Oracle数据库的DBID变更

有的时候相同的DBID是有问题的,如:在同一台机器上做逻辑DG

修改的方式如下:

关闭数据库

SHUTDOWN IMMEDIATE

启动数据库到mount的状态

STARTUP MOUNT


使用nid 命令进行更改,如下:


[oracle@dg2 ~]$ nid target=sys/password@LHZ


DBNEWID: Release 10.2.0.1.0 - Production on Mon Jan 16 09:18:00 2012


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


Connected to database LHZ (DBID=1330247278)


Connected to server version 10.2.0

 

Control Files in database:

    /u01/app/oracle/oradata/lhz/control01.ctl

    /u01/app/oracle/oradata/lhz/control02.ctl

    /u01/app/oracle/oradata/lhz/control03.ctl

 

Change database ID of database LHZ? (Y/[N]) => Y

 

Proceeding with operation

Changing database ID from 1330247278 to 1342602440

    Control File /u01/app/oracle/oradata/lhz/control01.ctl - modified

    Control File /u01/app/oracle/oradata/lhz/control02.ctl - modified

    Control File /u01/app/oracle/oradata/lhz/control03.ctl - modified

    Datafile /u01/app/oracle/oradata/lhz/system01.dbf - dbid changed

    Datafile /u01/app/oracle/oradata/lhz/undotbs01.dbf - dbid changed

    Datafile /u01/app/oracle/oradata/lhz/sysaux01.dbf - dbid changed

    Datafile /u01/app/oracle/oradata/lhz/users01.dbf - dbid changed

    Datafile /u01/app/oracle/oradata/lhz/example01.dbf - dbid changed

    Datafile /u01/app/oracle/oradata/lhz/temp01.dbf - dbid changed

    Control File /u01/app/oracle/oradata/lhz/control01.ctl - dbid changed

    Control File /u01/app/oracle/oradata/lhz/control02.ctl - dbid changed

    Control File /u01/app/oracle/oradata/lhz/control03.ctl - dbid changed

    Instance shut down

 

Database ID for database LHZ changed to 1342602440.

All previous backups and archived redo logs for this database are unusable.

Database is not aware of previous backups and archived logs in Recovery Area.

Database has been shutdown, open database with RESETLOGS option.

Succesfully changed database ID.

DBNEWID - Completed succesfully.


运行完上述命令之后需要将数据库resetlogs 的方式打开。


[oracle@dg2 ~]$ sqlplus /nolog


SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 16 09:30:32 2012


Coyright (c) 1982, 2005, Oracle.  All rights reserved.


SQL>conn /as sysdba


Connected.


SQL>alter database open


ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> alter database open resetlogs;

Database altered.


SQL> exit


SQL> select dbid,name from v$database;


      DBID NAME

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

1342602440 LHZ


SQL> 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值