There are three important files over which the entire Oracle system is standing. These three files are
- Control files
- Online redo log files, and
- Data files
What is the control file in Oracle?
Control files are small binary files that store information about the physical structure of the database. This information includes –
- database name,
- names and locations of data files,
- names and locations of online redo log files,
- current online redo log sequence number,
- checkpoint information,
- names and locations of RMAN backup files, and more
If you want to see what type of information is stored in your Control file then you query the V$CONTROLFILE_RECORD_SECTION dynamic performance view like this
[oracle@oracle-db-19c ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Feb 1 15:09:40 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL>
SQL>
SQL> show user;
USER is "SYS"
SQL>
SQL> set pagesize 200
SQL> set linesize 200
SQL>
SQL> select distinct type from v$controlfile_record_section;
TYPE
------------------------------------------------------------------------------------
TEMPORARY FILENAME
BACKUP CORRUPTION
BACKUP SPFILE
STANDBY DATABASE MATRIX
DATABASE BLOCK CORRUPTION
FOREIGN ARCHIVED LOG
INSTANCE SPACE RESERVATION
PDBINC RECORD
REDO THREAD
LOG HISTORY
DATAFILE COPY
PROXY COPY
MTTR
DATAFILE HISTORY
MULTI INSTANCE REDO APPLY
RMAN CONFIGURATION
BACKUP SET
BACKUP PIECE
BACKUP REDOLOG
DATABASE INCARNATION
GUARANTEED RESTORE POINT
RESTORE POINT
AUXILIARY DATAFILE COPY
CKPT PROGRESS
TABLESPACE
BACKUP DATAFILE
DELETED OBJECT
THREAD INSTANCE NAME MAPPING
REDO LOG
FILENAME
OFFLINE RANGE
RECOVERY DESTINATION
REMOVABLE RECOVERY FILES
DATABASE
DATAFILE
ARCHIVED LOG
FLASHBACK LOG
ACM OPERATION
COPY CORRUPTION
RMAN STATUS
PDB RECORD
TABLESPACE KEY HISTORY
42 rows selected.
SQL>
A control file is created at the same time the database is created. Every database has at least one control file. Since a control file is a binary file thus it is not directly accessible to you.
When does the control file come into action?
When the database is in NOMOUNT state, the database instance knows the location of the control file through the CONTROL_FILES initialization parameter of the spfile or init.ora file.
When you open your database in NOMOUNT mode, at this point the database instance only knows about the location of the CONTROL FILE. It doesn’t open it or access it.
oracle@oracle-db-19c ~]$
[oracle@oracle-db-19c ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Feb 1 15:15:45 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 629145392 bytes
Fixed Size 9137968 bytes
Variable Size 394264576 bytes
Database Buffers 209715200 bytes
Redo Buffers 16027648 bytes
SQL>
SQL> alter database mount;
Database altered.
SQL>
Now at this point when you alter your database into MOUNT mode then your control files are opened and read by the database instance. So we can say that the control files come into action when database gets mounted.