Mount the database whose name is to be changed
SQL> startup pfile=inithcc.ora nomount
ORACLE instance started.
Total System Global Area 100663296 bytes
Fixed Size 1217884 bytes
Variable Size 88083108 bytes
Database Buffers 8388608 bytes
Redo Buffers 2973696 bytes
SQL> alter database mount;
Database altered.
SQL> select name,open_mode from v$database;
NAME OPEN_MODE
--------- ----------
HCC MOUNTED
Use nid Utility to change the Database Name(from 9i or higher)
$ nid target=sys/as sysdba dbname=test
This may give the following Output
DBNEWID: Release 10.2.0.1.0 - Production on Thu May 19 19:33:31 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Password:
Connected to database HCC (DBID=1702020770)
Connected to server version 10.2.0
Control Files in database:
/home/hcctest/oracle/oradata/test/control/control01.ctl
/home/hcctest/oracle/oradata/test/control/control02.ctl
Change database ID and database name HCC to TEST? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 1702020770 to 2049770897
Changing database name from HCC to TEST
Control File /home/hcctest/oracle/oradata/test/control/control01.ctl - modif
ied
Control File /home/hcctest/oracle/oradata/test/control/control02.ctl - modif
ied
Datafile /home/hcctest/oracle/oradata/test/data/system.dbf - dbid changed, w
rote new name
Datafile /home/hcctest/oracle/oradata/test/data/undo.dbf - dbid changed, wro
te new name
Datafile /home/hcctest/oracle/oradata/test/data/sysaux.dbf - dbid changed, w
rote new name
Datafile /home/hcctest/oracle/oradata/test/data/temp.dbf - dbid changed, wro
te new name
Control File /home/hcctest/oracle/oradata/test/control/control01.ctl - dbid
changed, wrote new name
Control File /home/hcctest/oracle/oradata/test/control/control02.ctl - dbid
changed, wrote new name
Instance shut down
Database name changed to TEST.
Modify parameter file and generate a new password file before restarting.
Database ID for database TEST changed to 2049770897.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
modify db_name in init file
db_name=
mount the database
SQL> startup pfile=inittest.ora nomount
ORACLE instance started.
Total System Global Area 100663296 bytes
Fixed Size 1217884 bytes
Variable Size 88083108 bytes
Database Buffers 8388608 bytes
Redo Buffers 2973696 bytes
SQL> alter database mount;
Database altered.
SQL> alter system set db_name=test scope=spfile;
alter system set db_name=test scope=spfile
*
ERROR at line 1:
ORA-32017: failure in updating SPFILE
ORA-32016: parameter "db_name" cannot be updated in SPFILE
SQL> shutdown
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/home/hcctest/oracle/product/10.2.0/db_1/dbs/inithcctest.ora'
SQL> startup pfile=spfiletest.ora
LRM-00123: invalid character 0 found in the input file
ORA-01078: failure in processing system parameters
SQL> startup pfile=inittest.ora mount
ORACLE instance started.
Total System Global Area 100663296 bytes
Fixed Size 1217884 bytes
Variable Size 88083108 bytes
Database Buffers 8388608 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> alter database open resetlogs;
Database altered.
SQL> select name from v$database;
NAME
---------
TEST
SQL> startup pfile=inithcc.ora nomount
ORACLE instance started.
Total System Global Area 100663296 bytes
Fixed Size 1217884 bytes
Variable Size 88083108 bytes
Database Buffers 8388608 bytes
Redo Buffers 2973696 bytes
SQL> alter database mount;
Database altered.
SQL> select name,open_mode from v$database;
NAME OPEN_MODE
--------- ----------
HCC MOUNTED
Use nid Utility to change the Database Name(from 9i or higher)
$ nid target=sys/as sysdba dbname=test
This may give the following Output
DBNEWID: Release 10.2.0.1.0 - Production on Thu May 19 19:33:31 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Password:
Connected to database HCC (DBID=1702020770)
Connected to server version 10.2.0
Control Files in database:
/home/hcctest/oracle/oradata/test/control/control01.ctl
/home/hcctest/oracle/oradata/test/control/control02.ctl
Change database ID and database name HCC to TEST? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 1702020770 to 2049770897
Changing database name from HCC to TEST
Control File /home/hcctest/oracle/oradata/test/control/control01.ctl - modif
ied
Control File /home/hcctest/oracle/oradata/test/control/control02.ctl - modif
ied
Datafile /home/hcctest/oracle/oradata/test/data/system.dbf - dbid changed, w
rote new name
Datafile /home/hcctest/oracle/oradata/test/data/undo.dbf - dbid changed, wro
te new name
Datafile /home/hcctest/oracle/oradata/test/data/sysaux.dbf - dbid changed, w
rote new name
Datafile /home/hcctest/oracle/oradata/test/data/temp.dbf - dbid changed, wro
te new name
Control File /home/hcctest/oracle/oradata/test/control/control01.ctl - dbid
changed, wrote new name
Control File /home/hcctest/oracle/oradata/test/control/control02.ctl - dbid
changed, wrote new name
Instance shut down
Database name changed to TEST.
Modify parameter file and generate a new password file before restarting.
Database ID for database TEST changed to 2049770897.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
modify db_name in init file
db_name=
mount the database
SQL> startup pfile=inittest.ora nomount
ORACLE instance started.
Total System Global Area 100663296 bytes
Fixed Size 1217884 bytes
Variable Size 88083108 bytes
Database Buffers 8388608 bytes
Redo Buffers 2973696 bytes
SQL> alter database mount;
Database altered.
SQL> alter system set db_name=test scope=spfile;
alter system set db_name=test scope=spfile
*
ERROR at line 1:
ORA-32017: failure in updating SPFILE
ORA-32016: parameter "db_name" cannot be updated in SPFILE
SQL> shutdown
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/home/hcctest/oracle/product/10.2.0/db_1/dbs/inithcctest.ora'
SQL> startup pfile=spfiletest.ora
LRM-00123: invalid character 0 found in the input file
ORA-01078: failure in processing system parameters
SQL> startup pfile=inittest.ora mount
ORACLE instance started.
Total System Global Area 100663296 bytes
Fixed Size 1217884 bytes
Variable Size 88083108 bytes
Database Buffers 8388608 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> alter database open resetlogs;
Database altered.
SQL> select name from v$database;
NAME
---------
TEST
Comments
Post a Comment