DBNEWID工具初体验之db_name和dbid的更改_by小龙

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

DBNEWID 工具初体验之db_name 和dbid 的更改
欢迎访问我的博客/oraking
dbnewid 介绍....................................................................................................................................1 体验dbnewid....................................................................................................................................1 0.环境............................................................................................................................................1 1.改变前环境................................................................................................................................1 2. 一致性关闭数据库.....................................................................................................................2 3. 确保可以恢复的数据库备份(全备)......................................................................................2 4. 调用dbnewid 工具更改db_name 和dbid.................................................................................3 5. 修改参数文件中的db_name......................................................................................................4 6. 打开数据库.................................................................................................................................5 7. 验证该更改操作.........................................................................................................................5 8. 重新备份数据库.........................................................................................................................5 9. 注意事项. (5)
dbnewid 介绍
Prior to the introduction of the DBNEWID utility, you could manually create a copy of a database and give it a new database name (DBNAME) by re-creating the control file. However, you could not give the database a new identifier (DBID). The DBID is an internal, unique identifier for a database. Because Recovery Manager (RMAN) distinguishes databases by DBID, you could not register a seed database and a manually copied database together in the same RMAN repository. The DBNEWID utility solves this problem by allowing you to change any of the following: ■ Only the DBID of a database ■ Only the DBNAME of a database
■ Both the DBNAME and DBID of a database
---from Oracle® Database Utilities 10g Release 2 (10.2) B14215-01
体验dbnewid 0.环境
OS :windows xp sp3 DB :oracle 10g2 1.改变前环境
SQL> select dbid from v$database; DBID ---------- 1915115529
SQL> show parameter db_name
NAME TYPE ------------------------------------ --------------------------------- V ALUE
------------------------------
db_name string
U
n R
e g
i s
t e
r e
d
node2
2. 一致性关闭数据库 SQL> shutdown immediate SQL> startup mount
3. 确保可以恢复的数据库备份(全备)
U n R e g i s t e
r e
d
4. 调用dbnewid 工具更改db_name 和dbid
C:\Documents and Settings\Administrator>nid target=sys/oracle dbname=node3 DBNEWID: Release 10.2.0.1.0 - Production on Sat Jun 4 16:19:09 2011 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to database NODE2 (DBID=1915115529) Connected to server version 10.2.0 Control Files in database:
D:\ORACLE\PRODUCT\10.2.0\ORADATA\NODE2\CONTROL01.CTL D:\ORACLE\PRODUCT\10.2.0\ORADATA\NODE2\CONTROL02.CTL D:\ORACLE\PRODUCT\10.2.0\ORADATA\NODE2\CONTROL03.CTL Change database ID and database name NODE2 to NODE3? (Y/[N]) => y Proceeding with operation
Changing database ID from 1915115529 to 1880025661 Changing database name from NODE2 to NODE3
Control File D:\ORACLE\PRODUCT\10.2.0\ORADATA\NODE2\CONTROL01.CTL - modified
Control File D:\ORACLE\PRODUCT\10.2.0\ORADATA\NODE2\CONTROL02.CTL - modified
Control File D:\ORACLE\PRODUCT\10.2.0\ORADATA\NODE2\CONTROL03.CTL - modified
Datafile D:\ORACLE\PRODUCT\10.2.0\ORADATA\NODE2\SYSTEM01.DBF - dbid changed,
wrote new name
Datafile D:\ORACLE\PRODUCT\10.2.0\ORADATA\NODE2\UNDOTBS01.DBF - dbid changed
, wrote new name
Datafile D:\ORACLE\PRODUCT\10.2.0\ORADATA\NODE2\SYSAUX01.DBF - dbid changed,
U
n R
e g
i s
t e
r e
d
wrote new name
Datafile D:\ORACLE\PRODUCT\10.2.0\ORADATA\NODE2\USERS01.DBF - dbid changed,
wrote new name
Datafile D:\ORACLE\PRODUCT\10.2.0\ORADATA\NODE2\EXAMPLE01.DBF - dbid changed
, wrote new name
Datafile D:\ORACLE\PRODUCT\10.2.0\ORADATA\NODE2\TEMP01.DBF - dbid changed, w
rote new name
Control File D:\ORACLE\PRODUCT\10.2.0\ORADATA\NODE2\CONTROL01.CTL - dbid cha
nged, wrote new name
Control File D:\ORACLE\PRODUCT\10.2.0\ORADATA\NODE2\CONTROL02.CTL - dbid cha
nged, wrote new name
Control File D:\ORACLE\PRODUCT\10.2.0\ORADATA\NODE2\CONTROL03.CTL - dbid cha
nged, wrote new name Instance shut down
Database name changed to NODE3.
Modify parameter file and generate a new password file before restarting. Database ID for database NODE3 changed to 1880025661.
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.
5. 修改参数文件中的db_name SQL> shutdown immediate SQL> create pfile from spfile; File created.
修改参数文件中的db_name=node3 SQL> create spfile from pfile;
U
n R
e g
i s
t e
r e
d
File created.
SQL> startup mount 6. 打开数据库
SQL> alter database open resetlogs; 7. 验证该更改操作
SQL> select dbid from v$database; DBID ---------- 1880025661
SQL> show parameter db_name
NAME TYPE ------------------------------------ --------------------------------- V ALUE
------------------------------
db_name string node3
8. 重新备份数据库 9. 注意事项
Data guard 环境下不允许更改dbid ,一般将会出现以下错误 NID-00131 Control file is not current
U
n R
e g
i s
t e
r e
d
U
n R
e g
i s
t e
r e
d。

相关文档
最新文档