Rename Database 9i and above
Check the Db name
SQL> select name from v$database;
NAME
---------
SUN
START :
1.shutdown immediate
2.startup mount
3.$nid target=sys as sysdba dbname=orcl setname=yes
OUTPUT :
[oracle@Sunshine dbs]$ nid target=sys as sysdba dbname=orcl setname=yes
DBNEWID: Release 10.1.0.3.0 - Production
Copyright (c) 2001, 2004, Oracle. All rights reserved.
Password:
Connected to database SUN (DBID=1134261166)
Connected to server version 10.1.0
Control Files in database:
/home/oracle/product/10.1.0/oradata/orcl/control01.ctl
/home/oracle/product/10.1.0/oradata/orcl/control02.ctl
/home/oracle/product/10.1.0/oradata/orcl/control03.ctl
Change database name of database SUN to ORCL? (Y/[N]) => Y
Proceeding with operation
Changing database name from SUN to ORCL
Control File /home/oracle/product/10.1.0/oradata/orcl/control01.ctl - modified
Control File /home/oracle/product/10.1.0/oradata/orcl/control02.ctl - modified
Control File /home/oracle/product/10.1.0/oradata/orcl/control03.ctl - modified
Datafile /home/oracle/product/10.1.0/oradata/orcl/system01.dbf - wrote new name
Datafile /home/oracle/product/10.1.0/oradata/orcl/undotbs01.dbf - wrote new name
Datafile /home/oracle/product/10.1.0/oradata/orcl/sysaux01.dbf - wrote new name
Datafile /home/oracle/product/10.1.0/oradata/orcl/users01.dbf - wrote new name
Datafile /home/oracle/product/10.1.0/oradata/orcl/example01.dbf - wrote new name
Datafile /home/oracle/product/10.1.0/oradata/orcl/temp01.dbf - wrote new name
Control File /home/oracle/product/10.1.0/oradata/orcl/control01.ctl - wrote new name
Control File /home/oracle/product/10.1.0/oradata/orcl/control02.ctl - wrote new name
Control File /home/oracle/product/10.1.0/oradata/orcl/control03.ctl - wrote new name
Instance shut down
Database name changed to ORCL.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.
5.mv spfilesun.ora spfileorcl.ora
6.rm orapwsun
7.orapwd file=orapworcl password=orcl
8.EXPORT ORACLE_SID=orcl
9.sqlplus / as sysdba
10.startup force nomount quiet
11.alter system set db_name='orcl' scope=spfile
12.startup force;
13.SQL> select name from v$database;
NAME
---------
ORCL
DB name changed succesfully
Check the Db name
SQL> select name from v$database;
NAME
---------
SUN
START :
1.shutdown immediate
2.startup mount
3.$nid target=sys as sysdba dbname=orcl setname=yes
OUTPUT :
[oracle@Sunshine dbs]$ nid target=sys as sysdba dbname=orcl setname=yes
DBNEWID: Release 10.1.0.3.0 - Production
Copyright (c) 2001, 2004, Oracle. All rights reserved.
Password:
Connected to database SUN (DBID=1134261166)
Connected to server version 10.1.0
Control Files in database:
/home/oracle/product/10.1.0/oradata/orcl/control01.ctl
/home/oracle/product/10.1.0/oradata/orcl/control02.ctl
/home/oracle/product/10.1.0/oradata/orcl/control03.ctl
Change database name of database SUN to ORCL? (Y/[N]) => Y
Proceeding with operation
Changing database name from SUN to ORCL
Control File /home/oracle/product/10.1.0/oradata/orcl/control01.ctl - modified
Control File /home/oracle/product/10.1.0/oradata/orcl/control02.ctl - modified
Control File /home/oracle/product/10.1.0/oradata/orcl/control03.ctl - modified
Datafile /home/oracle/product/10.1.0/oradata/orcl/system01.dbf - wrote new name
Datafile /home/oracle/product/10.1.0/oradata/orcl/undotbs01.dbf - wrote new name
Datafile /home/oracle/product/10.1.0/oradata/orcl/sysaux01.dbf - wrote new name
Datafile /home/oracle/product/10.1.0/oradata/orcl/users01.dbf - wrote new name
Datafile /home/oracle/product/10.1.0/oradata/orcl/example01.dbf - wrote new name
Datafile /home/oracle/product/10.1.0/oradata/orcl/temp01.dbf - wrote new name
Control File /home/oracle/product/10.1.0/oradata/orcl/control01.ctl - wrote new name
Control File /home/oracle/product/10.1.0/oradata/orcl/control02.ctl - wrote new name
Control File /home/oracle/product/10.1.0/oradata/orcl/control03.ctl - wrote new name
Instance shut down
Database name changed to ORCL.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.
5.mv spfilesun.ora spfileorcl.ora
6.rm orapwsun
7.orapwd file=orapworcl password=orcl
8.EXPORT ORACLE_SID=orcl
9.sqlplus / as sysdba
10.startup force nomount quiet
11.alter system set db_name='orcl' scope=spfile
12.startup force;
13.SQL> select name from v$database;
NAME
---------
ORCL
DB name changed succesfully