Oracle Control File

 Every Oracle Database has a control file, which is a small binary file that records the physical structure of the database.

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:

  1. The database name and database unique identifier (DBID)
  2. The time stamp of database creation
  3. The current log sequence number
  4. Checkpoint information
  5. Information about data files, online redo log files, and archived redo log files
  6. Tablespace information
  7. 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.
  • Oracle Database reads and writes to the control file continuously during database use and must be available for writing whenever the database is open.

Multiplex Control Files

Every Oracle Database should have at least two control files, each stored on a different physical disks, the database can achieve redundancy and thereby avoid a single point of failure.

To check how many control file in your db:

show parameter control_files;
(OR)
select name from v$controlfile;

Add the Control File:

alter system set control_files='/u01/app/oracle/oradata/PEARL/control01.ctl','/u01/app/oracle/oradata/PEARL/control02.ctl' scope=spfile;

Down the Database:

shut immediate;
cd /u01/app/oracle/oradata/PEARL/
cp -rf control01.ctl control02.ctl

Start the Database and verify the control file:

show parameter control_files;

Multiplexing using pfile:

show parameter spfile;
create pfile='/u01/app/oracle/product/19.0.0/dbhome_1/dbs/initpearl.ora' from spfile;

Down the database:

shut immediate;

Copy from the control02 to control03.ctl

cd /u01/app/oracle/oradata/PEARL/
cp -rf control02.ctl control03.ctl

Update the control file parameter values:

vi /u01/app/oracle/product/19.0.0/dbhome_1/dbs/initpearl.ora
Before:
*.control_files='/u01/app/oracle/oradata/PEARL/control01.ctl','/u01/app/oracle/oradata/PEARL/control02.ctl'
After:
*.control_files='/u01/app/oracle/oradata/PEARL/control01.ctl','/u01/app/oracle/oradata/PEARL/control02.ctl','/u01/app/oracle/oradata/PEARL/control03.ctl'

Start the Database use pfile:

startup pfile='/u01/app/oracle/product/19.0.0/dbhome_1/dbs/initpearl.ora';
show parameter pfile;
show parameter control_files;
select name from v$controlfile;

Create Control File Trace:

ALTER DATABASE BACKUP CONTROLFILE TO TRACE AS '/path/to/tracefile.trc';

Comments