Wednesday, July 18, 2012

Creating Control Files

Creating Initial Control Files
The following is an example of a CONTROL_FILES initialization parameter:
CONTROL_FILES = (/u01/oracle/prod/control01.ctl,
                 /u02/oracle/prod/control02.ctl,
                 /u03/oracle/prod/control03.ctl)

Creating Additional Copies, Renaming, and Relocating Control Files
To add a multiplexed copy of the current control file or to rename a control file:

Shut down the database.
Shutdown immediate

Copy an existing control file to a new location, using operating system commands.
cp oldpath newpath

Edit the CONTROL_FILES parameter in the database initialization parameter file to add the new control file name, or to change the existing control filename.

Restart the database.
startup pfile=’<path of pfile>’

The CREATE CONTROLFILE Statement (It needed only you want to recreate a control file)
CREATE CONTROLFILE
   SET DATABASE <db name>
   LOGFILE GROUP 1 ('/u01/oracle/<db name>/redo01_01.log',
                    '/u01/oracle/<db name>/redo01_02.log'),
           GROUP 2 ('/u01/oracle/<db name>/redo02_01.log',
                    '/u01/oracle/<db name>/redo02_02.log'),
           GROUP 3 ('/u01/oracle/<db name>/redo03_01.log',
                    '/u01/oracle/<db name>/redo03_02.log')
   RESETLOGS
   DATAFILE '/u01/oracle/<db name>/system01.dbf' SIZE 3M,
            '/u01/oracle/<db name>/rbs01.dbs' SIZE 5M,
            '/u01/oracle/<db name>/users01.dbs' SIZE 5M,
            '/u01/oracle/prod/temp01.dbs' SIZE 5M
   MAXLOGFILES 50
   MAXLOGMEMBERS 3
   MAXLOGHISTORY 400
   MAXDATAFILES 200
   MAXINSTANCES 6
   ARCHIVELOG;

Dropping Control Files

Shut down the database.
Shutdown immediate

Edit the CONTROL_FILES parameter in the database initialization parameter file to delete the old control file name.

Restart the database.
startup pfile=’<path of pfile>’

Note:
This operation does not physically delete the unwanted control file from the disk. Use operating system commands to delete the unnecessary file after you have dropped the control file from the database.

Displaying Control File Information
The following views display information about control files:

View
Description
V$DATABASE
Displays database information from the control file
V$CONTROLFILE
Lists the names of control files
V$CONTROLFILE_RECORD_SECTION
Displays information about control file record sections
V$PARAMETER
Displays the names of control files as specified in the CONTROL_FILES initialization parameter


No comments:

Post a Comment