How to change a Database Name --Ramesh Togara (04/02/11)
Step 1 : startup the database and note down the dbname.
SQL>
startup
ORACLE instance started.
Total System Global Area 264241152 bytes
Fixed Size 1977976 bytes
Variable Size 138416520 bytes
Database Buffers 121634816 bytes
Redo Buffers 2211840 bytes
Database mounted.
Database opened.
SQL>
select instance_name from v$instance;
INSTANCE_NAME
----------------
ram
SQL>
select name from v$database;
NAME
---------
NEWDB1
Step 2 : shutdown the database and open in mount state
SQL>
shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
startup mount;
ORACLE instance started.
Total System Global Area 264241152 bytes
Fixed Size 1977976 bytes
Variable Size 142610824 bytes
Database Buffers 117440512 bytes
Redo Buffers 2211840 bytes
Database mounted.
Step 3 : now exit from sql promt and use nid oracle utility as specified below .
SQL>
exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
bash-3.00$
nid target=sys/ramesh dbname=mydb setname=y /* maximum database name length is 8 characters */
(below out put will be expected )
DBNEWID: Release 10.2.0.1.0 - Production on Fri Feb 4 13:55:29 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to database NEWDB1 (DBID=2730365025)
Connected to server version 10.2.0
Control Files in database:
/export/home/oracle/oradg/oradata/control01.ctl
/export/home/oracle/oradg/oradata/control02.ctl
/export/home/oracle/oradg/oradata/control03.ctl
Change database name of database NEWDB1 to MYDB? (Y/[N]) =>
Y /* enter Y for promting */
Proceeding with operation
Changing database name from NEWDB1 to MYDB
Control File /export/home/oracle/oradg/oradata/control01.ctl - modified
Control File /export/home/oracle/oradg/oradata/control02.ctl - modified
Control File /export/home/oracle/oradg/oradata/control03.ctl - modified
Datafile /export/home/oracle/oradg/oradata/system01.dbf - wrote new name
Datafile /export/home/oracle/oradg/oradata/undotbs01.dbf - wrote new name
Datafile /export/home/oracle/oradg/oradata/sysaux01.dbf - wrote new name
Datafile /export/home/oracle/oradg/oradata/users01.dbf - wrote new name
Datafile /export/home/oracle/oradg/oradata/temp01.dbf - wrote new name
Control File /export/home/oracle/oradg/oradata/control01.ctl - wrote new name
Control File /export/home/oracle/oradg/oradata/control02.ctl - wrote new name
Control File /export/home/oracle/oradg/oradata/control03.ctl - wrote new name
Instance shut down
Database name changed to MYDB.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.
Step 4 : change the db_name parameter value in initsid.ora file as new database name
bash-3.00$
pwd
/export/home/u01/app/oracle/product/10.2/dbs
bash-3.00$
vi initram.ora /* here change db_name prameter to 'mydb' */
"initram.ora" 34 lines, 1254 characters
oradg.__db_cache_size=117440512
oradg.__java_pool_size=4194304
oradg.__large_pool_size=4194304
oradg.__shared_pool_size=79691776
oradg.__streams_pool_size=0
*.audit_file_dest='/export/home/oracle/oradg/admin/adump'
*.background_dump_dest='/export/home/oracle/oradg/admin/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/export/home/oracle/oradg/oradata/control01.ctl','/export/home/oracle/oradg/oradata/control02.ctl','/export/home/oracle/oradg/oradata/control03.ctl'
*.core_dump_dest='/export/home/oracle/oradg/admin/cdump'
*.cursor_sharing='SIMILAR'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='newdb1' ----------------------------------------------------> this is need to be changed to 'mydb'
*.instance_name='ram'
*.log_archive_dest_1='location=/export/home/oracle/oradg/arch'
*.log_archive_dest_2='service=standby lgwr sync'
*.log_archive_dest_state_1='enable'
*.log_archive_dest_state_2='enable'
*.log_archive_start=true
*.open_cursors=300
*.os_authent_prefix=''
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.service_names='primary'
*.session_cached_cursors=50
*.sga_max_size=250m
*.sga_target=200m
*.smtp_out_server=' '
*.standby_archive_dest='/export/home/oracle/oradg/arch'
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/export/home/oracle/oradg/admin/udump'
~
~
~
~
~
~
~
~
~
"initram.ora" 34 lines, 1252 characters
Step 5 : create a new password file
bash-3.00$
rm orapwram
bash-3.00$
orapwd file=orapwram password=ramesh entries=5
bash-3.00$
sqlplus sys/ramesh as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Feb 4 13:57:46 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
Step 6 : open the database with new initsid.ora file and find the new database name
SQL>
startup pfile=initram.ora nomount;
ORACLE instance started.
Total System Global Area 264241152 bytes
Fixed Size 1977976 bytes
Variable Size 138416520 bytes
Database Buffers 121634816 bytes
Redo Buffers 2211840 bytes
SQL>
alter database mount;
Database altered.
SQL>
alter database open;
Database altered.
SQL>
select name from v$database;
NAME
---------
MYDB -------------> successfully changed.
SQL>
create spfile from pfile;
File created.
SQL>
create pfile from spfile;
File created.
SQL>
shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
startup;
ORACLE instance started.
Total System Global Area 264241152 bytes
Fixed Size 1977976 bytes
Variable Size 138416520 bytes
Database Buffers 121634816 bytes
Redo Buffers 2211840 bytes
Database mounted.
Database opened.
SQL>
select name from v$database;
NAME
---------
MYDB
-------------------------------- END OF DOCUMENT --------------------------------