Database Architecture   «Prev  Next»

Lesson 4 The Control File
ObjectiveIdentify the purpose and contents of the database control file.

Oracle Database Control File Information

Every Oracle database contains a control file[1]. The control file gives Oracle a place to store important information about the physical state of the database. It contains the following information:
  1. The database name
  2. Information about tablespaces
  3. The names and locations of all the datafiles
  4. The names and locations of all the redo log files
  5. The current log sequence number
  6. Checkpoint information
  7. Information about redo logs and the current state of archiving

Main function of the Control File

Perhaps the most significant use of the control file is to keep track of all the other files that make up the database. When you start an instance and open a database, Oracle reads the initialization file to find the name and location of the control file. Then it reads the control file to find the names and locations of all the datafiles and redo log files. Finally it opens all those files, making the database available for you to use.

Importance of the Control File

The control file is so critical to the proper operation of an Oracle database that Oracle encourages you to keep at least three copies of the control file at all times. These should be on separate disks, and preferably separate controllers .
That is why the initialization file that you saw in the last lesson listed three control file names. The Oracle database software always writes the same information to all control files, thus keeping them in sync with one another. The following paragraphs discuss in further detail the control and initialization files of the Oracle database architecture.

Data in control files and initialization files


Data types
Data types

Control Files

A database should have at least two copies of the control file on different physical disks. Without a current copy of the control file, you run the risk of losing track of portions of your database. Losing control files is not necessarily fatal and there are ways to rebuild them. However, rebuilding control files can be difficult, introduces risk, and can be easily avoided. The location of the control files is defined, as previously mentioned, by the
CONTROL_FILES 

initialization parameter. You can specify multiple copies of control files by indicating multiple locations in the CONTROL_FILES parameter for the instance, as illustrated here:
control_files = (/u00/oradata/control.001.dbf,
/u01/oradata/control.002.dbf,
/u02/oradata/control.003.dbf)

This parameter tells the instance where to find the control files. Oracle will ensure that all copies of the control file are kept in sync so all updates to the control files will occur at the same time. If you do not specify this parameter, Oracle will create a control file using a default filename or by leveraging Oracle Managed Files (if enabled). Many Oracle Databases are deployed on some type of redundant disk solution such as RAID-1 or RAID-5 to avoid data loss when a disk fails. You might conclude that storing the control file on protected disk storage eliminates the need for maintaining multiple copies of control files and that losing a disk will not mean loss of the control file. But there are two reasons why this is not an appropriate conclusion.

Control Files

Every Oracle database has a control file. For example, it contains the following information:
  1. Database name
  2. Names and locations of datafiles and redo log files
  3. Time stamp of database creation
Oracle can multiplex the control file, that is, simultaneously maintain a number of identical control file copies, to protect against a failure involving the control file. Every time an instance of an Oracle database is started, its control file identifies the database and redo log files that must be opened for database operation to proceed. If the physical makeup of the database is altered (for example, if a new datafile or redo log file is created), then the control file is automatically modified by Oracle to reflect the change. A control file is also used in database recovery.

Control Files The control files include information about the file structure of the database and the current log sequence number being written by LGWR. During normal recovery procedures, the information in a control file guides the automatic progression of the recovery operation.

[1] control file: A control file contains entries that specify the physical structure of the database.