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 ...
随机推荐
- 在IE8下background-image不显示的解决方法
刚写一个页面,在chrome,FF里调试完后,忽然想起ie来,放到Ie里其它还好了,但是有个背景图片显示不出来. 调试N遍后,只好上stackoverflow去找一下,果然找到了. 最初是这样写的: ...
- maya2012安装失败如何卸载重装
AUTODESK系列软件着实令人头疼,安装失败之后不能完全卸载!!!(比如maya,cad,3dsmax等).有时手动删除注册表重装之后还是会出现各种问题,每个版本的C++Runtime和.NET f ...
- hash冲突解决和javahash冲突解决
其实就是四种方法的演变 1.开放定址法 具体就是把数据的标志等的对长度取模 有三种不同的取模 线性探测再散列 给数据的标志加增量,取模 平方探测再散列 给数据的标志平方,取模 随机探测再散列 把数据的 ...
- grunt项目构建
最近想把项目里添加grunt,说白了就是前端自动化管理,具体配置如下: 用到以下几个部件: grunt-contrib-cssmin grunt-contrib-uglify grunt-contri ...
- StringBuilder做函数参数
StringBuilder做函数参数: static void Main(string[] args) { StringBuilder sb = new StringBuilder(); Hello( ...
- maven课程 项目管理利器-maven 3-3 maven中的坐标和仓库
本节主要讲了两大方面: 1 maven坐标 1.0 构件定义 任何依赖,插件,项目构建输出 都称之为构件. 1.1 maven坐标概念 groupid 公司或组织的域名倒序+当前项目名称 artif ...
- 顺序链表(C++)
顺序表结构 struct Sq_list { ]; int length; }; 创建并初始化顺序表 int Init_list(Sq_list *L) { L->length = ; ; } ...
- Python常用模块(二)
一.json与pickle json与pickle模块是为了完成数据的序列化. 序列化是指把对象(变量)从内存中变成可存储或传输的过程,在Python中叫picking,在其他语言中也由其他的叫法,但 ...
- canvas制作运动的小球
<!DOCTYPE html> <head> <title>canvas</title> <style> .canvas{ border: ...
- 解决浏览器窗口缩小出现白色背景的bug
父容器上添加最小宽度min-width=xxxpx min-width的值大于浏览器横向滚动条出现时的宽度.