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 ...
随机推荐
- Linux环境常用命令
bash host #查看IP对应机器名 hostname #查看本机名 hostname –i #查看本机IP mssh ...
- sort命令和对中文的处理
使用示例:sort -k1,1nr xxxfile 需要指定起始列和结束列,否则可能排序错误 sort命令应用于中文时需要在sort前设置环境变量(以兼容C语言的标准): LC_COLLATE=C ...
- (七)使用jedis连接单机和集群(一步一个坑踩出来的辛酸泪)
环境准备: redis-4.0.9,最新版了 ruby:redis-x.x.x.gem 这个gem什么版本都行,我redis4用3.0.0的gem正常跑 jedis-2.9.0.jar,最新版 ...
- pat1019. General Palindromic Number (20)
1019. General Palindromic Number (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN ...
- iOS-swift-函数和闭包
一.函数 关键字:func 参数列表用 , 分割 使用 -> 分割参数和返回值 func greet(person: String, day: String) -> String { re ...
- 修复kindEditor点击加粗, 内容焦点跳动的问题
大概1560~1569行 pos : function() { var self = this, node = self[0], x = 0, y = 0; if (node) { if (node. ...
- 将php代码部署到新浪云测试(简单方法,包含数据库的连接)
很多人做项目都是先在本地测试然后上传到服务器运行,如果包含了操作数据库的信息往往需要进行一番调试,这里我总结一下把php代码包含数据库的连接如何上传到新浪云服务器的步骤. 1.在新浪云应用SAE的控制 ...
- aliyun maven repository
<mirrors> <mirror> <id>alimaven</id> <name>aliyun maven</name> & ...
- HTML三种样式引入方式
HTML三种样式引入方式 HTML有三种样式引入方式:行内样式(inline Styles).嵌入式样式表(Embedded Style Sheets).外部样式表(External Style ...
- React 表单组件
诸如 <input>.<textarea>.<option> 这样的表单组件不同于其他组件,因为他们可以通过用户交互发生变化.这些组件提供的界面使响应用户交互的表单 ...