Oracle 使用Nid 修改数据库的DBID 和 Database Name
How to Change the DBID, DBNAME Using NID Utility (Doc ID 863800.1)
Changing the DBID and Database Name (DB_NAME) :
1. Ensure you have valid cold/hot backup of database. If it's a hot backup (RMAN or OS), ensure you also have all the archived logs and backup of all Online Redo logs (after database is consistently shutdown).
2. export ORACLE_HOME=<Path of the Oracle Home> -- Unix and Linux
set ORACLE_HOME=<Path of the Oracle Home> -- Windows
3. cd <Oracle Home>/bin
4. Drop the dbconsole :
Refer to the following note for more information:
Note.278100.1 How To Drop, Create And Recreate DB Control In A 10g Database.
5. Bring the database to the Mount stage:
    SQL> STARTUP MOUNT
6. If you need to use TNS to connect to database, make sure that you have DB_OLD specified in the tnsnames.ora and listener is started.
    You can also check if you able to connect to the database using sqlplus :   
  $ sqlplus sys/<password>@DB_OLD
7. Issue following command to invoke NID utility:
or
$ nid TARGET=SYS/password DBNAME=DB_NEW
The following is an example of what the output for this would look like:
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to database TSTNID2 (DBID=729333573)
Connected to server version 10.2.0
Control Files in database:
    D:\ORACLE\ORADATA\DB102NEW\CONTROL01.CTL
    D:\ORACLE\ORADATA\DB102NEW\CONTROL02.CTL
    D:\ORACLE\ORADATA\DB102NEW\CONTROL03.CTL
Change database ID and database name TSTNID2 to TSTNID3? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 729333573 to 2473929266
Changing database name from DB_OLD to DB_NEW
Control File D:\ORACLE\ORADATA\DB102NEW\CONTROL01.CTL - modified
Control File D:\ORACLE\ORADATA\DB102NEW\CONTROL02.CTL - modified
Control File D:\ORACLE\ORADATA\DB102NEW\CONTROL03.CTL - modified
Datafile D:\ORACLE\ORADATA\DB102NEW\SYSTEM01.DBF - dbid changed, wrote new name
Datafile D:\ORACLE\ORADATA\DB102NEW\UNDOTBS01.DBF - dbid changed, wrote new name
Datafile D:\ORACLE\ORADATA\DB102NEW\SYSAUX01.DBF - dbid changed, wrote new name
Datafile D:\ORACLE\ORADATA\DB102NEW\USERS01.DBF - dbid changed, wrote new name
Datafile D:\ORACLE\ORADATA\DB102NEW\EXAMPLE01.DBF - dbid changed, wrote new name
Datafile D:\ORACLE\ORADATA\DB102NEW\TEST.DBF - dbid changed, wrote new name
Datafile D:\ORACLE\ORADATA\DB102NEW\TEMP01.DBF - dbid changed, wrote new name
Datafile D:\ORACLE\ORADATA\DB102NEW\TEMP011.DBF - dbid changed, wrote new name
Control File D:\ORACLE\ORADATA\DB102NEW\CONTROL01.CTL - dbid changed, wrote new name
Control File D:\ORACLE\ORADATA\DB102NEW\CONTROL02.CTL - dbid changed, wrote new name
Control File D:\ORACLE\ORADATA\DB102NEW\CONTROL03.CTL - dbid changed, wrote new name
Instance shut down
Database name changed to DB_NEW.
Modify parameter file and generate a new password file before restarting.
Database ID for database DB_NEW changed to 2473929266.
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 name and ID.
DBNEWID - Completed succesfully.
8. Change the DB_NAME in the pfile/spfile:
    Set the DB_NAME initialization parameter in the initialization parameter file (PFILE) to  the new   
    database name.
9. If you are using ASM and want to change the file name, follow this Article at this point
10. NID Utility will shutdown the database after the execution. So mount the database once again. 
    SQL> STARTUP MOUNT
11. Open the database in RESETLOGS mode: 
    SQL> ALTER DATABASE OPEN RESETLOGS;
12. Recreate the password file since the DB NAME has been changed:
where
file - name of password file (mand),
password - password for SYS (mand),
entries - maximum number of distinct DBA,
force - whether to overwrite existing file (opt),
nosysdba - whether to shut out the SYSDBA logon (opt for Database Vault only).
Note: There are no spaces around the equal-to (=) character.
On Unix/Linux the passwordfile convention is : $ORACLE_HOME/dbs/orapw$ORACLE_SID
On MS Windows the passwordfile convention is : %ORACLE_HOME%\database\PWD%ORACLE_SID%.ORA
13. Change the $ORACLE_HOME/network/admin/tnsnames.ora file wherever it has the old db name.
14. If there is a static registration of the database in the listener.ora file then change the database name in the following file $ORACLE_HOME/network/admin/listener.ora.
 
15. Change of Global Database Names:
If you are dealing with a database in a distributed database system, then each database should have a unique global database name. The DBNEWID utility does not change global database names. This can only be done with the SQL ALTER DATABASE statement, for which the syntax is as follows:
The global database name is made up of a database name and a domain, which are determined by the DB_NAME and DB_DOMAIN initialization parameters when the database is first created.
Windows specific steps:
16. Recreate the Database Service :
17. Recreate the DB Console service :
This command will ask you the new SID and will delete and recreate the service.
Refer to the following note for more information:
Note.278100.1 How To Drop, Create And Recreate DB Control In A 10g Database
Changing Only the Database ID
1-6 except 4. Follow the steps 1 to 6 (except step 4) given in above section.
7. Issue following command to invoke the NID utility:
or
$ nid TARGET=SYS/password
8. NID Utility will shutdown the database after the execution. So mount the database once again. 
    SQL> STARTUP MOUNT
9. Open the database in RESETLOGS mode: 
    SQL> ALTER DATABASE OPEN RESETLOGS;
Changing Only the Database Name
1-6. Follow the steps 1 to 6 given in first section.
7. Invoke the NID utility using following command
   You must specify both the DBNAME and SETNAME parameters.
or
$ nid TARGET=SYS/password DBNAME=test_db SETNAME=YES
8. Change the DB_NAME in the pfile/spfile: Follow step 8 from the first section.
9. If you are using ASM and want to change the file name, follow this Article at this point
10. Start up the database in normal mode.
    SQL> STARTUP mount
11 - 16 Follow steps 11 to 16 given in the first section as applicable.
Logs for NID :
The operation performed by NID is recorded in the alert file:
For example:
DBNAME will be changed from PROD to new DBNAME of TEST_DB
Starting datafile conversion
Datafile conversion complete
Database name changed to TEST_DB.
Modify parameter file and generate a new password file before restarting.
Successfully changed database name.
*** DBNEWID utility finished successfully ***
Oracle 使用Nid 修改数据库的DBID 和 Database Name的更多相关文章
- MySQL创建和修改数据库语法
		
1.创建数据库语法: CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name [create_specification [, create_spe ...
 - MSSQL 修改数据库的排序规则
		
1.修改数据库排序规则 ALTER DATABASE [CHARACTER] COLLATE Chinese_PRC_CI_AS ; 2.修改表中列的排序规则 如果下列其中之一当前正在引用一个列,则无 ...
 - MSSQL2005 修改数据库的排序规则
		
1.修改数据库排序规则ALTER DATABASE [DataBaseName] COLLATE Chinese_PRC_CI_AS ; 2.修改表中列的排序规则 如果下列其中之一当前正在引用一个列, ...
 - Oracle NID工具修改数据库DBID、数据库名称、数据库实例名
		
DBID是数据库的唯一标识符,在一些特殊场合会涉及到DBID的相关内容,本篇文章的目的是演示将DB_NAME的值从ORCL修改为ORCL1. 一.查看当前的环境 [oracle@oracledb ad ...
 - oracle nid修改dbname
		
修改name的目的只是为了日后管理清晰点,不重复.我比较懒.记性又差,所以就整理记下1.检查当前nameSQL> show parameter nameNAME TYPE VALUE------ ...
 - Oracle :修改数据库服务器字符集
		
最近,有现场反应,程序显示乱码.感觉很奇怪,该系统已经卖出去无数了.肯定是现场数据库字符集有问题,经过查看, 现场环境: window系统,oracle10g. 我们要求的数据库字符集是AL32UTF ...
 - Oracle 11g中修改默认密码过期天数和锁定次数
		
Oracle 11g中修改默认密码过期天数和锁定次数 密码过期的原因一般有两种可能: 一.由于Oracle中默认在default概要文件中设置了"PASSWORD_LIFE_TIME=180 ...
 - Ubuntu 安装 mysql 并修改数据库目录
		
. . . . . 今天折腾了一下午的时间,恢复了无数次虚拟机快照,终于在 Ubuntu 上把 mysql 安装好了. mysql 是从官网下载的:mysql-server_5.7.16-1ubunt ...
 - ORACLE查看并修改session和连接最大数
		
第一步,在cmd命令行,输入sqlplus 第二步,根据提示输入用户名与密码 1. 查看processes和sessions参数 SQL> show parameter processes NA ...
 
随机推荐
- bootstrap-datetimepicker:基于twitter bootstrap的日期/时间选择控件
			
bootstrap-datetimepicker是一个基于twitter bootstrap的简单日期/时间选择控件. <!DOCTYPE HTML> <html> <h ...
 - Windows 10 JDK安装及环境配置(vim+gcc)
			
JDK安装 首先去官网下载JDK:点击进入 下载后点击安装: 中途会提示安装jre,注意jre的安装文件夹和jdk的不能相同,不然会覆盖掉jdk里面的jre文件.可以创建一个Java文件夹.将jdk和 ...
 - stm32 外部中断学习
			
今天我们看看STM32的外部中断实验. STM32 供 IO 口使用的中断线只有 16 个,但是 STM32 的 IO 口却远远不止 16 个,那么 STM32 是怎么把 16 个中断线和 IO 口一 ...
 - DEDE日期调用小插件
			
在日期文本框里面,点击的时候,下面出来一个和万年历一样的日期选择表,在dede里面,有一个现成的js小插件,直接调用就OK了... <input type="text" on ...
 - jQuery 间歇式无缝滚动特效分享(三张图片平行滚动)
			
最近项目中门户首页需要做出图片间歇式无缝滚动特效,但是在网上找资料都是不太理想,不过可以指导.最后自己写了一个demo实现了这个特效,分享出来. 1.jquery.cxscroll.js /*! * ...
 - POJ 3164——Command Network——————【最小树形图、固定根】
			
Command Network Time Limit: 1000MS Memory Limit: 131072K Total Submissions: 15080 Accepted: 4331 ...
 - 多ComboBox实现复杂查询
			
关键是,你是要实现什么功能:是四个条件都有内容时查询,还是哪个内容有查哪个? 如果四个组合框都有内容,相对简单些: string s = "select * from 表名 where 身份 ...
 - iOS 警告收集快速消除
			
1.ld: warning: directory not found for option 去掉警告的方法 工程老是提示ld: warning: directory not found for opt ...
 - vue学习第二天 ------ 临时笔记
			
学习链接: vue.js官方文档: https://cn.vuejs.org/v2/guide/index.html vue.js API: https://cn.vuejs.org/v2/api/# ...
 - 关于基于Linphone的视频通话Android端开发过程中遇到的问题
			
关于基于Linphone的视频通话Android端开发过程中遇到的问题 运用开源项目Linphone的SDK进行开发,由于是小组进行开发,我主要负责的是界面部分. 由于当时是初学Android开发,对 ...