Tuesday, February 2, 2010

RENAMING A DATABASE

# Rename Database:

1. Change the db_names, global_names to the new DB name in the init parameter file
2. Change ORACLE_SID to new name
3. Create new passwordfile using orapwd utility
4. Now connect as sysdba
5. execute 'create controlfile ' command as shown below :

CREATE CONTROLFILE
SET DATABASE 'new_dbname'
datafile '$systemdbf_filepath/system.dbf' SIZE 500M,
'$toolsdbf_filepath/tools.dbf' SIZE 40M,
'$tempdbf_filepath/temp.dbf' SIZE 10M,
'$rbsdbf_filepath/rbs' SIZE 40M,
'$indxdbf_filepath/indx.dbf' SIZE 30M,
'$usersdbf_filepath/users.dbf' SIZE 30M
logfile group 1 ('$ORACLE_HOME/log/redo01a.log','$ORACLE_HOME2/log/redo01b.log') SIZE 10M,
group 2 ('$ORACLE_HOME/log/redo02a.log','$ORACLE_HOME/log/redo02b.log') SIZE 10M,
group 3 ('$ORACLE_HOME/log/redo03a.log','$ORACLE_HOME/log/redo03b.log') SIZE 10M
MAXDATAFILES 10
MAXLOGFILES 32
NORESETLOGS;

6. Edit the entry of dbname in /var/opt/oracle/oratab (for Solaris - auto start)
7. Edit the name of $ORACLE_SID to the new dbname
8. Update GLOBAL_NAME table with the new DB Name as sys user
Note: Use Noresetlogs command only when you loose all your redologs or when you want to create new redologs replacing old redologs. Using noresetlogs results in minor loss of data

No comments:

Post a Comment

Your Comments on blog are strongly welcomed..