Monday, August 8, 2011

How to Create & Rename Control File in Oracle Database

Each and every database in Oracle has a control file. Control file is a small binary file that contains the physical structure of the database. It also contains the database name, checkpoint information, log file sequence number, timestamp of the database creation, and many more. It is created when the database is created. An oracle database can have more than one control files but one control file is must that is created when database is created.


Sometimes, database administrators want to add some more control files in the database. This can be done by the “CREATE CONTROLFILE” statement. The statement is given below:

CREATE CONTROLFILE

   SET DATABASE prod

   LOGFILE GROUP 1 ('/u01/oracle/prod/redo01_01.log',
                    '/u01/oracle/prod/redo01_02.log'),
           GROUP 2 ('/u01/oracle/prod/redo02_01.log',
                    '/u01/oracle/prod/redo02_02.log'),
           GROUP 3 ('/u01/oracle/prod/redo03_01.log',
                    '/u01/oracle/prod/redo03_02.log')

   RESETLOGS

   DATAFILE '/u01/oracle/prod/system01.dbf' SIZE 3M,

            '/u01/oracle/prod/rbs01.dbs' SIZE 5M,
            '/u01/oracle/prod/users01.dbs' SIZE 5M,
            '/u01/oracle/prod/temp01.dbs' SIZE 5M

MAXLOGFILES 50
MAXLOGMEMBERS 3
MAXLOGHISTORY 400
MAXDATAFILES 200
MAXINSTANCES 6
ARCHIVELOG;

Caution: Oracle recommends that take a full backup of all your files before using the above statement.

Steps for Creating a new control file in Oracle Database: Follow the given below steps to create a new control file in the oracle database.
  • Make the list of all redo log files and data files.
  • Shutdown the oracle database.
  • Take the backup of all redo log files and data files.
  • Start a new instance.
  • Create a new control file with the help of above statement.
  • Take a backup of new control file on off-line storage device.
Rename Control File: You can rename the existing control file by the given below steps.
  • Shutdown the Oracle Database.
  • Copy the existing control to a new location.
  • Edit the control files from the database initialization parameter to add new name.
  • Restart the Oracle Database.

No comments:

Post a Comment