You are on page 1of 6

1) What is Control File

Every Oracle Database has a control file, which is a small binary file that records the physical structure of the database. he control file includes Database name !ames and location of associated datafiles and redo lo" files he timestamp of the database creation he current lo" se#uence number Chec$point information

he control file must be available for writin" by the Oracle database server whenever the database is open. With control file database cannot be mounted and recovery is difficult. . he control file of an Oracle database is created at the same time as the database. %y default, at least one copy of control file is created durin" database creation.

&) 'uidelines for control files (rovide file names for control files )ultiple*in" control files on different dis$s %ac$up control files )ana"e the si+e of control files

(rovide file names for control files ,pecify control file names in initiali+ation parameter file by usin" CO! -O./F0.E, parameter.

he instance reco"ni+es and opens all the listed file durin" database startup, and instance writes to and maintains all listed control files durin" database operation )ultiple*in" control files on different dis$s Every oracle database should have at least two control files, each stored on different physical dis$s. 0f a control file is dama"ed due to dis$ failure, the associated instance must be shutdown. Once the dis$ drive is repaired, the dama"ed control file can be restored usin" the intact

copy of the control file from other dis$ and the instance can be restarted. 0n this case, no media recovery is re#uired. he behavior of multiple*ed control file is this1 he database writes to all filenames listed for the initiali+ation parameter CO! -O./F0.E, in the database initiali+ation parameter file he database reads only first file listed in the CO! -O./F0.E, parameter durin" database operation. 0f any of the control file become unavailable durin" database operation, the instance become inoperable and should be aborted.

%ac$up control file it is very important that you bac$ your control files. his is true initially, and every time you chan"e the physical structure of your database. ,uch structural chan"es includes 2ddin", droppin" or renamin" datafiles 2ddin" or droppin" tablespace, or alterin" the the read3write state of the tablespace 2ddin" or droppin" redo lo" files or "roups

)ana"e the si+e of control file the main determinants of the si+e of a control file are the values set for the )24D2 2F0.E,, )24.O'F0.E,, )24.O')E)%E-,, )24.O'50, O-6, and )240!, 2!CE, parameters in the C-E2 E D2 2%2,E statement that created the associate database. 0ncreasin" the value of these parameters increase the si+e of a control file of the associate database 7) Creatin" control file

he initial control files of an oracle database are created when you issue C-E2 E D2 2%2,E statement. he names of the control files are specified by CO! -O./F0.E, parameter in the initiali+ation parameter file used durin" database creation.

he followin" are the e*ample of a control files CO! -O./F0.E,893u:13oracle3prod3control1.ctl, 3u:&3oracle3prod3control&.ctl,

3u:73oracle3prod3control7.ctl) 0f files with the specified names currently e*ist at the time of database creation, you must specify the CO! -O.F0.E -E,;,E clause in the C-E2 E D2 2%2,E statement< or else an error occurs. 2lso, if the si+e of the old control files differs from the new one, you cannot use the -E;,E clause. 6ou can subse#uently chan"e the value of the CO! -O./F0.E, initiali+ation parameter to add more control files or chan"e the name of the e*istin" location of e*istin" control files. =) Creatin" additional copies, renamin", and relocatin" control files 6ou can create an additional control file copy for multiple*in" by copyin" an e*istin" control file to a new location and addin" the file name to list of the control files. ,imilarly, you rename an e*istin" control file by file to its new name or new location, and chan"in" the file name in the control file list. 0n both cases, to "uarantee that control files do not chan"e durin" the procedure, shutdown the database before copyin" the files o add multiple*ed copy of the current control file or to rename current control file1 ,hut down the database Copy the e*istin" control file to new location usin" operatin" system command Edit the CO! -O./F0.E, parameters in the database initiali+ation parameter file to add the new control file name, or to chan"e the e*istin" control file name -estart the database

>) Creatin" new control files When to create new control files it is necessary you to create control files in the followin" situations 2ll control files for the database have been permanently dama"ed and you don?t have a control file bac$up 6ou want to chan"e the database name

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;

@) ,teps for creatin" new control file Complete the followin" steps to create new control file A) Chec$in" for missin" or e*tra files 2fter creatin" the new control file and usin" it to open the database, chec$ the alert lo" to see if the database has detected inconsistencies between the data dictionary and the control file, such as datafile in the data dictionary includes and the control file does not list. 0f a datafile e*ists in the data dictionary but not in the new control file, the database creates a placeholder entry in the control file under the name )0,,0!'nnnn, where nnnn is the file number in decimal. )0,,0!'nnnn is fla""ed in the control file as bein" offline and re#uirin" media recovery. 0f the actual datafile correspondin" to )0,,0!'nnnn is readBonly or offline normal, then you ma$e the datafile accessible by renamin" )0,,0!'nnnn to the name of actual datafile. 0f )0,,0!'nnnn corresponds to a datafile that was not readBonly or offline normal, then you cannot use the rename operation to ma$e the datafile accessible, because the datafile re#uires media recovery that is precluded by results or -E,E .O',. 0n this case, you must drop the tablespace containin" the datafile. Conversely, if a datafile listed in the control file is not present the data dictionary, then the database removes the references to it from the new control file. 0n both cases, the database includes an e*planatory messa"e in the alert lo" to let you $now what was found.

C) %ac$in" up control file

;se the 2. E- D2 2%2,E %2CD;( CO! -O.F0.E statement to bac$up your control files. 6ou have two options. %ac$ up the control file to a binary file 9duplicate of e*istin" control file) usin" the followin" statement

2. E- D2 2%2,E %2CD;( CO! -O.F0.E O E3u:13oracle3bac$up3control.ctl?< (roduce a ,F. statements that can later be used to recreate your control file

2. E- D2 2%2,E %2CD;( CO! -O.F0.E O -2CE< his command writes a ,F. script to a trace file where it can be captured and edited to reproduce the control file. Giew the alert lo" to determine the name and location of the trace file. H) -ecoverin" a control file usin" a current copy his procedure assumes that one of the control files specified in the CO! -O./F0.E, parameter is corrupted, that the control file directory is still accessible, and that you have a multiple*ed copy of the control file With the instance shut down, use an operatin" system command to overwrite the bad control file with a "ood copy

I cp 3u:73oracle3prod3control:7.ctl 3u:&3oracle3prod3control:&.ctl ,tar ,F. J(lus and open the database ,F.K , 2- ;( 1:) -ecoverin" from permanent media failure usin" a control file copy

his procedure assumes that one of the control files specified in CO! -O./F0.E, parameter is inaccessible due to media failure and that you have a multiple*ed copy of the control file With the instance shut down, use an operatin" system command to copy the current copy of the control file to a new, accessible location

I cp 3u:73oracle3prod3control:7.ctl 3u:&3oracle3prod3control:&.ctl Edit the CO! -O./F0.E, parameter in the initiali+ation parameter file to replace the bad location with the new location
CONTROL_FILES = (/u01/oracle/prod/control01.ctl, /u02/oracle/prod/control02.ctl, /u04/oracle/prod/control03.ctl)

,tar ,F. J(lus and open the database ,F.K , 2- ;(

Dropping Control Files


6ou want to drop control files from the database, for e*ample, if the location of a control file is no lon"er appropriate. -emember that the database should have at least two control files at all times. 1. ,hut down the database. 2. Edit the CONTROL_FILES parameter in the database initiali+ation parameter file to delete the old control file name. 3. -estart the database.

Control Files Data Dictionary Views


he followin" views display information about control files1 his e*ample lists the names of the control files.
SQL> SELECT NAME FROM V$CONTROLFILE; NAME ------------------------------------/u01/oracle/prod/control01.ctl /u02/oracle/prod/control02.ctl /u03/oracle/prod/control03.ctl

You might also like