有的时候相同的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>