#########原来的##################
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
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测试能够正常登陆.