5 Control Files And Multiplexing

Database Administration · Unit 5

Control Files and Multiplexing

Exam-focused notes for Control Files and Multiplexing (Database Administration, BIT352): what the TU syllabus asks and how it has actually been tested, with 1 solved past questions from this unit.

Control Files and Multiplexing in short

The control file is a small but vital file. This chapter explains what it holds and how to keep more than one copy so one disk failure does not stop the database.

Control Files and Multiplexing: notes

Control file definition and purpose

A control file is a binary file that records the physical structure of the database. Oracle reads it when the instance moves from NOMOUNT to MOUNT.

Its purposes:

  • Tell the instance where the datafiles and redo log files are.
  • Keep the database name and the checkpoint position.
  • Help Oracle decide whether recovery is needed at startup.
  • Store backup information used by RMAN.

If every copy of the control file is lost, the database cannot be mounted. It must be restored from a backup or re-created.

Control file contents and structure

A control file holds:

  • Database name and unique database identifier (DBID).
  • Database creation time stamp.
  • Names, locations and status of datafiles and online redo log files.
  • Tablespace information.
  • Current redo log sequence number.
  • Checkpoint information (SCN).
  • Archived log history and RMAN backup records.

Control file contents can be viewed with these queries.

SELECT name FROM v$controlfile;
SHOW PARAMETER control_files
ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
ALTER DATABASE BACKUP CONTROLFILE TO '/backup/control.bkp';

BACKUP CONTROLFILE TO TRACE writes a script that can re-create the control file.

What this unit covers

  • Control file definition and purpose
  • Control file contents and structure
  • Multiplexing control files
  • Multiplexing using pfile procedures

Control file definition and purpose

0 · 10 marks

What is control file? What are the contents of control file? Explain the procedure of multiplexing control file using pfile.[10]

Show solved answer

Control File in Oracle Database

What is a Control File?

A control file is a small binary file that is essential to the Oracle database. It records the physical structure of the database and is read by Oracle at database startup. The control file must be available and accessible whenever the database is mounted or opened.

Key characteristics:

  • It is a binary file (cannot be edited manually)
  • It is created automatically when the database is created
  • Oracle must have access to the control file to mount and open the database
  • It is continuously updated by Oracle during database operation

Contents of a Control File

The control file stores critical information about the database, including:

  1. Database Name - The name of the database as specified during creation
  2. Database Identifier (DBID) - A unique identifier for the database
  3. Database Creation Timestamp - Date and time when the database was created
  4. Tablespace Names - Names of all tablespaces in the database
  5. Names and Locations of Datafiles - Physical paths of all datafiles
  6. Names and Locations of Redo Log Files - Physical paths of all online redo log files
  7. Current Log Sequence Number - The sequence number of the current redo log
  8. Checkpoint Information - Details about the most recent checkpoint
  9. Begin and End of Undo Segments - Information about undo/rollback segments
  10. RMAN Backup Information - Details of RMAN backups (if RMAN is used)
  11. Archive Log History - Information about archived redo log files
  12. SCN (System Change Number) - The current SCN of the database

Multiplexing Control File Using PFILE

Multiplexing means maintaining multiple copies of the control file on different disk locations. This protects against loss of the control file due to disk failure.

Why Multiplex?

  • If the single control file is lost or corrupted, the database cannot be started
  • Oracle recommends keeping 2 to 3 copies of the control file on separate disks

Procedure to Multiplex Control File Using PFILE

Step 1: Check the Current Control File Location

Log in to SQL*Plus as SYSDBA and check the current control file locations:

SQL> SHOW PARAMETER CONTROL_FILES;

or

SQL> SELECT NAME FROM V$CONTROLFILE;

This shows the current path(s) of the control file(s).


Step 2: Shut Down the Database

Shut down the database cleanly before making changes:

SQL> SHUTDOWN IMMEDIATE;

Step 3: Locate and Edit the PFILE

The PFILE (Parameter File) is a text-based initialization file, typically located at:

$ORACLE_HOME/dbs/initSID.ora   (Linux/Unix)
%ORACLE_HOME%\database\initSID.ora   (Windows)

Open the PFILE using a text editor and find the CONTROL_FILES parameter. It may look like:

control_files = ('/u01/oradata/orcl/control01.ctl')

Modify it to include the new (additional) control file location:

control_files = ('/u01/oradata/orcl/control01.ctl',
                 '/u02/oradata/orcl/control02.ctl',
                 '/u03/oradata/orcl/control03.ctl')

Save and close the PFILE.


Step 4: Copy the Existing Control File to New Locations

Using the operating system commands, copy the existing control file to the new paths specified in the PFILE:

On Linux/Unix:

$ cp /u01/oradata/orcl/control01.ctl /u02/oradata/orcl/control02.ctl
$ cp /u01/oradata/orcl/control01.ctl /u03/oradata/orcl/control03.ctl

On Windows:

COPY C:\oradata\orcl\control01.ctl D:\oradata\orcl\control02.ctl

Note: This copy must be done while the database is shut down, because the control file is a binary file and must be consistent.


Step 5: Start the Database Using the Modified PFILE

Start the database using the PFILE:

SQL> STARTUP PFILE='/u01/app/oracle/product/19c/dbs/initorcl.ora';

Step 6: Verify the Multiplexed Control Files

After startup, verify that Oracle is now using all the control file copies:

SQL> SELECT NAME FROM V$CONTROLFILE;

Expected Output:

NAME
------------------------------------------
/u01/oradata/orcl/control01.ctl
/u02/oradata/orcl/control02.ctl
/u03/oradata/orcl/control03.ctl

Step 7: (Optional) Create SPFILE from PFILE

If the database normally uses an SPFILE, recreate it from the updated PFILE:

SQL> CREATE SPFILE FROM PFILE='/u01/app/oracle/product/19c/dbs/initorcl.ora';

Then restart the database normally:

SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP;

Summary Table

StepAction
1Check current control file locations
2Shut down the database
3Edit PFILE to add new control file paths
4Copy control file to new OS locations
5Start database using PFILE
6Verify multiplexed control files
7Optionally recreate SPFILE

Best Practice: Always store control file copies on separate physical disks to ensure protection against disk failure.

Open this answer on its own page →