利用nid修改数据库的DBID

转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/19263339


1、运行nid,显示如下参数:

oracle@mydb 2014_02_15]$ nid


DBNEWID: Release 11.2.0.3.0 - Production on Sun Feb 16 00:10:38 2014


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


Keyword     Description                    (Default)
----------------------------------------------------
TARGET      Username/Password              (NONE)     - --指定数据库的用户名和密码
DBNAME      New database name              (NONE)      ---创建新的数据库名以及DBID
LOGFILE     Output Log                     (NONE)
REVERT      Revert failed change           NO
SETNAME     Set a new database name only   NO       ---如果只更改数据库名,请指定SETNAME=Y
APPEND      Append to output log           NO
HELP        Displays these messages        NO




2、查出原来的DBID=2217289411
sys@OCM> SELECT NAME,DBID FROM V$DATABASE;


NAME                       DBID
-------------------- ----------
OCM                  2217289411




3、关闭数据库并启动到MOUNT
sys@OCM> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
sys@OCM> startup mount;
ORACLE instance started.


Total System Global Area 1006809088 bytes
Fixed Size                  2233520 bytes
Variable Size             478153552 bytes
Database Buffers          419430400 bytes
Redo Buffers              106991616 bytes
Database mounted.




4、在LINUX命令提示符中运行nid命令,这里只更改DBID
sys@OCM> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
You have new mail in /var/spool/mail/oracle
[oracle@mydb ~]$ nid target=system/oracle


DBNEWID: Release 11.2.0.3.0 - Production on Sun Feb 16 00:19:12 2014


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


Connected to database OCM (DBID=2217289411)


Connected to server version 11.2.0


Control Files in database:
    /u01/app/oracle/oradata/ocm/control01.ctl
    /u01/app/oracle/oradata/ocm/control02.ctl


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


Proceeding with operation
Changing database ID from 2217289411 to 2222218432
    Control File /u01/app/oracle/oradata/ocm/control01.ctl - modified
    Control File /u01/app/oracle/oradata/ocm/control02.ctl - modified
    Datafile /u01/app/oracle/oradata/ocm/system01.db - dbid changed
    Datafile /u01/app/oracle/oradata/ocm/sysaux01.db - dbid changed
    Datafile /u01/app/oracle/oradata/ocm/undotbs01.db - dbid changed
    Datafile /u01/app/oracle/oradata/ocm/users01.db - dbid changed
    Datafile /u01/app/oracle/oradata/ocm/example01.db - dbid changed
    Datafile /u01/app/oracle/oradata/ocm/tp1.db - dbid changed
    Datafile /u01/app/oracle/oradata/ocm/tp2.db - dbid changed
    Datafile /u01/app/oracle/oradata/ocm/tp3.db - dbid changed
    Datafile /u01/app/oracle/oradata/ocm/temp01.db - dbid changed
    Control File /u01/app/oracle/oradata/ocm/control01.ctl - dbid changed
    Control File /u01/app/oracle/oradata/ocm/control02.ctl - dbid changed
    Instance shut down


Database ID for database OCM changed to 2222218432.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database ID.
DBNEWID - Completed succesfully.



5、使用resetlogs打开数据库
[oracle@mydb ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.3.0 Production on Sun Feb 16 00:20:36 2014


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


Connected to an idle instance.


idle> startup mount;
ORACLE instance started.


Total System Global Area 1006809088 bytes
Fixed Size                  2233520 bytes
Variable Size             478153552 bytes
Database Buffers          419430400 bytes
Redo Buffers              106991616 bytes
Database mounted.
idle> alter database open resetlogs;


Database altered.


6、查看数据库的DBID
idle> SELECT NAME,DBID FROM V$DATABASE;


NAME            DBID
--------- ----------
OCM       2222218432


由原来的DBID=2217289411变为DBID=2222218432.

你可能感兴趣的:(数据库,dbid,nid)