oracle修改db_name 在数据库open状态下修改 是报如下错误,因为db_name 还存在于控制文件中
alter system set db_name=hot scope=spfile
alter system set db_name=hot scope=spfile
ERROR at line 1:
ORA-32017: failure in updating SPFILE
ORA-32016: parameter "db_name" cannot be updated in SPFILE
可以通过nid工具来修改db_name和dbid
1.启动到mount状态
startup mount
ORACLE instance started.
Total System Global Area 1686925312 bytes
Fixed Size 2213976 bytes
Variable Size 671090600 bytes
Database Buffers 1006632960 bytes
Redo Buffers 6987776 bytes
Database mounted.
2. nid target=sys/bybon2014 dbname=hot
DBNEWID: Release 11.2.0.1.0 - Production on Thu Feb 12 17:40:31 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to database DG (DBID=1784648301)
Connected to server version 11.2.0
Control Files in database:
+ASMOCR/dg/controlfile/current.258.871317183
+ASMOCR/dg/controlfile/current.259.871317183
Change database ID and database name DG to HOT? (Y/[N]) => y
Proceeding with operation
Changing database ID from 1784648301 to 2590842639
Changing database name from DG to HOT
Control File +ASMOCR/dg/controlfile/current.258.871317183 - modified
Control File +ASMOCR/dg/controlfile/current.259.871317183 - modified
Datafile +ASMOCR/dg/datafile/system.261.87131724 - dbid changed, wrote new n
ame
Datafile +ASMOCR/dg/datafile/sysaux.260.87131721 - dbid changed, wrote new n
ame
Datafile +ASMOCR/dg/datafile/undotbs1.262.87131725 - dbid changed, wrote new
name
Datafile +ASMOCR/dg/datafile/users.264.87131726 - dbid changed, wrote new na
me
Datafile +ASMOCR/dg/datafile/undotbs2.263.87131725 - dbid changed, wrote new
name
Datafile +ASMOCR/dg/tempfile/temp.277.87131730 - dbid changed, wrote new nam
e
Control File +ASMOCR/dg/controlfile/current.258.871317183 - dbid changed, wr
ote new name
Control File +ASMOCR/dg/controlfile/current.259.871317183 - dbid changed, wr
ote new name
Instance shut down
Database name changed to HOT.
Modify parameter file and generate a new password file before restarting.
Database ID for database HOT changed to 2590842639.
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.
此时数据库已经关闭了 需要用resetlogs启动
startup mount;
ORACLE instance started.
Total System Global Area 1686925312 bytes
Fixed Size 2213976 bytes
Variable Size 671090600 bytes
Database Buffers 1006632960 bytes
Redo Buffers 6987776 bytes
ORA-01103: database name 'HOT' in control file is not 'DG'
此时参数文件的参数db_name 还没有更改呢
alter system set db_name=hot scope=spfile;
shutdown immediate
startup mount
alter database open resetlogs;
此时已经可以正常使用了
select name from v$database;
NAME
---------
HOT
阅读(1790) | 评论(0) | 转发(0) |