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