A technical troubleshooting blog about Oracle with other Databases & Cloud Technologies.

Control files in Oracle (Physical Storage)

4 min read
The database control file is a small binary file associated with only one database.

Each database has one unique control file, although multiple identical copies are permitted.
Use of Control Files

Oracle Database uses the control file to locate database files and to manage the state of the database generally.

A control file contains information such as the following:

• The database name and database unique identifier (DBID)
• The time stamp of database creation
• Information about data files, online redo log files, and archived redo log files
• Tablespace information
• RMAN backups
The control file serves the following purposes:

• It contains information about data files, online redo log files, and so on that are required to open the database.

The control file tracks structural changes to the database. For example, when an administrator adds, renames, or drops a data file or online redo log file, the database updates the control file to reflect this change.

• It contains metadata that must be accessible when the database is not open.

For example, the control file contains information required to recover the database, including checkpoints. A checkpoint indicates the SCN in the redo stream where instance recovery would be required to begin. Every committed change before a checkpoint SCN is guaranteed to be saved on disk in the data files. At least every three seconds the checkpoint process records information in the control file about the checkpoint position in the online redo log.

Oracle Database reads and writes to the control file continuously during database use and must be available for writing whenever the database is open. For example, recovering a database involves reading from the control file the names of all the data files contained in the database. Other operations, such as adding a data file, update the information stored in the control file.
Multiple Control Files

Oracle Database enables multiple, identical control files to be open concurrently and written to the same database. By  multiplexing a control file on different disks, the database can achieve redundancy and thereby avoid a single point of failure.

If a control file becomes unusable, then the database instance fails when it attempts to access the damaged control file. When other current control file copies exist, then you can remount the database and open it without media recovery. If all control files of a database are lost, however, then the database instance fails and media recovery is required. Media recovery is not straightforward if an older backup of a control file must be used because a current copy is not available.

Control File Structure

Information about the database is stored in different sections of the control file. Each section is a set of records about an aspect of the database.

For example, one section in the control file tracks data files and contains a set of records, one for each data file. Each section is stored in multiple logical control file blocks. Records can span blocks within a section.

The control file contains the following types of records:

• Circular reuse records

A circular reuse record contains noncritical information that is eligible to be overwritten if needed. When all available record slots are full, the database either expands the control file to make room for a new record or overwrites the oldest record. Examples include records about archived redo log files and RMAN backups.

• Noncircular reuse records

A noncircular reuse record contains critical information that does not change often and cannot be overwritten. Examples of information include tablespaces, data files, online redo log files, and redo threads. Oracle Database never reuses these records unless the corresponding object is dropped from the tablespace.

You can query the dynamic performance views, also known as V$ views, to view the information stored in the control file. For example, you can query V$DATABASE to obtain the database name and DBID.

However, only the database can modify the information in the control file. Reading and writing the control file blocks is different from reading and writing data blocks. For the control file, Oracle Database reads and writes directly from the disk to the program global area (PGA). Each process allocates a certain amount of its PGA memory for control file blocks.

Locating Control Files

The preconfigured database contains two control files located in the ORACLE_BASE\oradata\DB_NAME directory.

The preconfigured database contains two control files located in the ORACLE_BASE\oradata\DB_NAME directory. Oracle recommends that you keep at least two control files (on separate physical drives) for each database, and set the CONTROL_FILES initialization parameter to list each control file.
You can use this SQL*Plus commands to find the Oracle control file locations:

SQL> show parameter control_files

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      /u01/app/oracle/oradata/asrblg/control01.ctl, /u01/app/oracle/flash_recovery_area/asrblg/control02.ctl
SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/asrblg/control01.ctl
/u01/app/oracle/flash_recovery_area/asrblg/control02.ctl