Changing the Name of a Database

Oracle

If you ever want to change the name of database or want to change the setting of MAXDATAFILES, MAXLOGFILES, MAXLOGMEMBERS then you have to create a new control file.

Creating a New Control File

Follow the given steps to create a new controlfile

Steps:

  1. First generate the create controlfile statement

                SQL>alter database backup controlfile to trace;

After giving this statement oracle will write the CREATE CONTROLFILE statement in a trace file. The trace file will be randomly named something like ORA23212.TRC and it is created in USER_DUMP_DEST directory.

  1. Go to the USER_DUMP_DEST directory and open the latest trace file in text editor. This file will contain the CREATE CONTROLFILE statement. It will have two sets of statement one with RESETLOGS and another without RESETLOGS. Since we are changing the name of the Database we have to use RESETLOGS option of CREATE CONTROLFILE statement. Now copy and paste the statement in a file. Let it be c.sql
  1. Now open the c.sql file in text editor and set the database name from ica to prod shown in an example below

CREATE CONTROLFILE

   SET DATABASE prod   

   LOGFILE GROUP 1 (‘/u01/oracle/ica/redo01_01.log’,

                    ‘/u01/oracle/ica/redo01_02.log’),

           GROUP 2 (‘/u01/oracle/ica/redo02_01.log’,

                    ‘/u01/oracle/ica/redo02_02.log’),

           GROUP 3 (‘/u01/oracle/ica/redo03_01.log’,

                    ‘/u01/oracle/ica/redo03_02.log’)

   RESETLOGS

   DATAFILE ‘/u01/oracle/ica/system01.dbf’ SIZE 3M,

            ‘/u01/oracle/ica/rbs01.dbs’ SIZE 5M,

            ‘/u01/oracle/ica/users01.dbs’ SIZE 5M,

            ‘/u01/oracle/ica/temp01.dbs’ SIZE 5M

   MAXLOGFILES 50

   MAXLOGMEMBERS 3

   MAXLOGHISTORY 400

   MAXDATAFILES 200

   MAXINSTANCES 6

   ARCHIVELOG;

  1. Start and do not mount the database.

SQL>STARTUP NOMOUNT;

  1. Now execute c.sql script

SQL> @/u01/oracle/c.sql

  1. Now open the database with RESETLOGS

SQL>ALTER DATABASE OPEN RESETLOGS;