对于有些系统由于Oracle的数据库名称不符合规范,在不想重新创建数据库的情况下使用Oracle自带的nid工具修改数据库名称。在整个修改过程中,对控制文件和数据文件进行修改,且重置dbid,建议在修改前对数据进行备份。
在本例子中,我们将数据库中的instance_name和db_name从“oratest”修改为“test”,数据库版本为10.2.0.3。
查看数据库信息。
SQL> show parameter instance_name NAME TYPE VALUE ———————————— ———– —————————— stance_name string ORATEST SQL> show parameter db_name NAME TYPE VALUE ———————————— ———– —————————— db_name string ORATEST SQL>show parameter service_name NAME TYPE VALUE ———————————— ———– —————————— db_name string ORATEST SQL>select dbid from v$database; DBID ———- 3213300265 |
SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount Total System Global Area 268435456 bytes Fixed Size 1261272 bytes Variable Size 117440808 bytes Database Buffers 146800640 bytes Redo Buffers 2932736 bytes Database mounted. SQL> host; $ nid target=”sys/password” dbname=test DBNEWID: Release 10.2.0.3.0 – Production on Wed Feb 4 11:12:36 2009 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to database ORATEST (DBID=3213300265) Connected to server version 10.2.0 Control Files in database: /u02/oradata/test/control01.ctl /u02/oradata/test/control02.ctl /u02/oradata/test/control03.ctl Change database ID and database name ORATEST to TEST? (Y/[N]) => y Proceeding with operation Changing database ID from 3213300265 to 1976074532 Changing database name from ORATEST to TEST Control File /u02/oradata/test/control01.ctl – modified Control File /u02/oradata/test/control02.ctl – modified Control File /u02/oradata/test/control03.ctl – modified Datafile /u02/oradata/test/system01.dbf – dbid changed, wrote new name Datafile /u02/oradata/test/undotbs01.dbf – dbid changed, wrote new name Datafile /u02/oradata/test/sysaux01.dbf – dbid changed, wrote new name Datafile /u02/oradata/test/users01.dbf – dbid changed, wrote new name Datafile /u02/oradata/test/example01.dbf – dbid changed, wrote new name Datafile /u02/oradata/test/temp01.dbf – dbid changed, wrote new name Control File /u02/oradata/test/control01.ctl – dbid changed, wrote new name Control File /u02/oradata/test/control02.ctl – dbid changed, wrote new name Control File /u02/oradata/test/control03.ctl – dbid changed, wrote new name NID-00600: Internal Error – [28] [12152] [0] [0] Change of database name and ID failed during validation – database is intact. DBNEWID – Completed with validation errors. |
修改参数文件中相关信息,启动数据库。
SQL> startup mount ORACLE instance started. Total System Global Area 268435456 bytes Fixed Size 1261272 bytes Variable Size 121635112 bytes Database Buffers 142606336 bytes Redo Buffers 2932736 bytes ORA-01103: database name ‘TEST’ in control file is not ‘ORATEST’ SQL> alter system set db_name=test scope=spfile; System altered. SQL> SQL> shutdown immediate ORA-01507: database not mounted ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 268435456 bytes Fixed Size 1261272 bytes Variable Size 125829416 bytes Database Buffers 138412032 bytes Redo Buffers 2932736 bytes Database mounted. ORA-01589: must use RESETLOGS or NORESETLOGS option for database open SQL> show parameter db_name NAME TYPE VALUE ———————————— ———– —————————— db_name string TEST SQL> show parameter instance_name NAME TYPE VALUE ———————————— ———– —————————— instance_name string ORATEST SQL> show parameter service_name NAME TYPE VALUE ———————————— ———– —————————— service_names string TEST SQL> alter database open resetlogs ; Database altered. SQL> SQL> select dbid from v$database; DBID ———- 1976074532 SQL> |
我们一直都在努力坚持原创.......请不要一声不吭,就悄悄拿走。
我原创,你原创,我们的内容世界才会更加精彩!
【所有原创内容版权均属TechTarget,欢迎大家转发分享。但未经授权,严禁任何媒体(平面媒体、网络媒体、自媒体等)以及微信公众号复制、转载、摘编或以其他方式进行使用。】
微信公众号
TechTarget
官方微博
TechTarget中国
作者
相关推荐
-
Collaborate 18大会:了解甲骨文云数据库和应用的进展
在Collaborate 18大会即将举行时,我们会发现,甲骨文用户社区的技术变化会略高于平常水平。 由独立甲 […]
-
甲骨文自治数据库亮相 带来云计算新希望
早前甲骨文还不在云计算公司之列,而现在该公司正在迅速弥补其失去的时间。甲骨文的云计算核心是甲骨文自治数据库(O […]
-
Oracle TNS 错误:管理员旷日持久的战斗
TNS经常给IT管理员带来麻烦,而且很难定位。尤其是在Oracle数据库中。本文将介绍如何避免这些常见错误。
-
DBA支招:如何实现Oracle EBS 12.2.5升级
那些对于是否要将EBS进行升级持观望态度的Oracle数据库管理员们可以从一家研究公司获得一些启示。