Change DB Name.


Step by Step:
 SQL> startup mount
 ORACLE instance started.
 
 Total System Global Area  595591168 bytes
 Fixed Size                  1220748 bytes
 Variable Size             209719156 bytes
 Database Buffers          377487360 bytes
 Redo Buffers                7163904 bytes
 Database mounted.
 SQL> 
 
 [oracle@anar ~]$ nid
 
 DBNEWID: Release 10.2.0.1.0 - Production on Thu Jul 21 11:52:54 2011
 
 Copyright (c) 1982, 2005, Oracle.  All rights reserved.
 
 Keyword     Description                    (Default)
 ----------------------------------------------------
 TARGET      Username/Password              (NONE)
 DBNAME      New database name              (NONE)
 LOGFILE     Output Log                     (NONE)
 REVERT      Revert failed change           NO
 SETNAME     Set a new database name only   NO
 APPEND      Append to output log           NO
 HELP        Displays these messages        NO
 
 [oracle@anar ~]$ nid target=sys/oracle@anar_f as sysdba dbname=anar_f1
 
 DBNEWID: Release 10.2.0.1.0 - Production on Thu Jul 21 12:19:19 2011
 
 Copyright (c) 1982, 2005, Oracle.  All rights reserved.
 
 Password: 
 Connected to database ANAR_F (DBID=604182317)
 
 Connected to server version 10.2.0
 
 Control Files in database:
     /u01/app/oracle/anar_f/controlfile/control01.ctl
     /u01/app/oracle/anar_f/controlfile/control02.ctl
     /u01/app/oracle/anar_f/controlfile/control03.ctl
 
 Change database ID and database name ANAR_F to ANAR_F1? (Y/[N]) => y
 
 Proceeding with operation
 Changing database ID from 604182317 to 3902868108
 Changing database name from ANAR_F to ANAR_F1
     Control File /u01/app/oracle/anar_f/controlfile/control01.ctl - modified
     Control File /u01/app/oracle/anar_f/controlfile/control02.ctl - modified
     Control File /u01/app/oracle/anar_f/controlfile/control03.ctl - modified
     Datafile /u01/app/oracle/anar_f/system100.dbf - dbid changed, wrote new name
     Datafile /u01/app/oracle/anar_f/myundo.dbf - dbid changed, wrote new name
     Datafile /u01/app/oracle/anar_f/sysaux100.dbf - dbid changed, wrote new name
     Datafile /u01/app/oracle/anar_f/tsanar01.dbf - dbid changed, wrote new name
     Datafile /u01/app/oracle/anar_f/tsanar02.dbf - dbid changed, wrote new name
     Datafile /u01/app/oracle/anar_f/users01.dbf - dbid changed, wrote new name
     Datafile /u01/app/oracle/anar_f/users02.dbf - dbid changed, wrote new name
     Datafile /u01/ivants.dbf - dbid changed, wrote new name
     Datafile /u01/app/oracle/pri_rman.dbf - dbid changed, wrote new name
     Datafile /u01/app/oracle/rman_moni.dbf - dbid changed, wrote new name
     Datafile /u01/app/oracle/anar_f/temp01.dbf - dbid changed, wrote new name
     Control File /u01/app/oracle/anar_f/controlfile/control01.ctl - dbid changed, wrote new name
     Control File /u01/app/oracle/anar_f/controlfile/control02.ctl - dbid changed, wrote new name
     Control File /u01/app/oracle/anar_f/controlfile/control03.ctl - dbid changed, wrote new name
     Instance shut down
 
 Database name changed to ANAR_F1.
 Modify parameter file and generate a new password file before restarting.
 Database ID for database ANAR_F1 changed to 3902868108.
 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.
 
 Now we need to change our parameter file:
 
 [oracle@anar ~]$ cd $ORACLE_HOME/dbs
 [oracle@anar dbs]$ mv initanar_f.ora initanar_f1.ora
 [oracle@anar dbs]$ vi initanar_f1.ora 
 
 Alter the parameter DB_NAME=<newdbname>
 
 [oracle@anar dbs]$ export ORACLE_SID=anar_f1
 [oracle@anar dbs]$ sqlplus / as sysdba
 
 SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jul 21 12:24:15 2011
 
 Copyright (c) 1982, 2005, Oracle.  All rights reserved.
 
 Connected to an idle instance.
 
 SQL> startup
 ORACLE instance started.
 
 Total System Global Area  595591168 bytes
 Fixed Size                  1220748 bytes
 Variable Size             163581812 bytes
 Database Buffers          423624704 bytes
 Redo Buffers                7163904 bytes
 Database mounted.
 ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
 
 
 SQL> alter database open resetlogs;
 
 Database altered.
 
 SQL> create spfile from pfile;
 
 File created.
 
 Just to check if is everything ok in the initialization:
 
 SQL> shut immediate
 Database closed.
 Database dismounted.
 ORACLE instance shut down.
 SQL> startup
 ORACLE instance started.
 
 Total System Global Area  595591168 bytes
 Fixed Size                  1220748 bytes
 Variable Size             163581812 bytes
 Database Buffers          423624704 bytes
 Redo Buffers                7163904 bytes
 Database mounted.
 Database opened.
 SQL> 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: