使用nid工具修改db_name和DBID


#########原来的##################
SQL> select dbid from v$database;

      DBID
----------
1490502756

SQL> select name from v$database;

NAME
---------
ORCL

推荐在nid修改数据库name和DBID之前进行全库备份,最好是冷备

修改过程:

1. 数据库重启到mount

2. 指定参数

[oracle@dongsc2 ~]$ nid -help

DBNEWID: Release 11.2.0.4.0 - Production on Thu Dec 14 15:07:12 2017

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

Keyword    Description                    (Default)
----------------------------------------------------
TARGET      Username/Password              (NONE)
DBNAME      New database name              (NONE)
LOGFILE    Output Log                    (NONE)
REVERT      Revert failed change          NO
SETNAME    Set a new database name only  NO
APPEND      Append to output log          NO
HELP        Displays these messages        NO

3. 修改

[oracle@dongsc2 ~]$ nid TARGET=sys/oracle DBNAME=dongsc LOGFILE=nid_1214.log

4. 看输出

[oracle@dongsc2 ~]$ tailf -100 nid_1214.log
DBNEWID: Release 11.2.0.4.0 - Production on Thu Dec 14 15:10:04 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
Connected to database ORCL (DBID=1490502756)
Connected to server version 11.2.0
Control Files in database:
    /u01/app/oracle/oradata/ORCL/controlfile/o1_mf_f347m4sd_.ctl
Changing database ID from 1490502756 to 3893510668
Changing database name from ORCL to DONGSC
    Control File /u01/app/oracle/oradata/ORCL/controlfile/o1_mf_f347m4sd_.ctl - modified
    Datafile /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_f347jch4_.db - dbid changed, wrote new name
    Datafile /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_f347jclf_.db - dbid changed, wrote new name
    Datafile /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_f347jcln_.db - dbid changed, wrote new name
    Datafile /u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_f347jcmg_.db - dbid changed, wrote new name
    Datafile /u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_f347n7f4_.db - dbid changed, wrote new name
    Datafile /u01/app/oracle/oradata/ORCL/datafile/o1_mf_temp_f347mrk4_.tm - dbid changed, wrote new name
    Control File /u01/app/oracle/oradata/ORCL/controlfile/o1_mf_f347m4sd_.ctl - dbid changed, wrote new name
    Instance shut down
Database name changed to DONGSC.
Modify parameter file and generate a new password file before restarting.
Database ID for database DONGSC changed to 3893510668.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
提示所有的redo已经不能用了
提示需要修改参数文件,创建新的密码文件

SQL> select dbid,name from v$database;

      DBID NAME
---------- ---------
3893510668 DONGSC



5. 修改参数文件,创建密码文件

*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/u01/app/oracle/oradata/ORCL/controlfile/o1_mf_f347m4sd_.ctl'
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata'
*.db_domain=''
*.db_name=' dongsc'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.instance_name=' dongsc'
*.log_archive_dest_1='LOCATION=/archivelog'
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=102760448
*.processes=100
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=115
*.sga_target=308281344
*.undo_tablespace='UNDOTBS1'

注意修改环境变量的sid,和修改spfiledongsc.ora ,否则重启之后,smon依旧是orcl
生成orapwd
[oracle@dongsc2 dbs]$ orapwd file=orapwdongsc password=oracle

使用PLSQL DEV测试能够正常登陆.










  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值