Oracle資料庫的DBID變更

來源:互聯網
上載者:User

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.