oracle 修改 dbid,利用nid修改数据库的DBID

利用nid修改数据库的DBID

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.

©著作权归作者所有:来自51CTO博客作者guoyJoe的原创作品,如需转载,请注明出处,否则将追究法律责任

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值