what is control file in oracle database

Questions like What is a control file in Oracle Database have been asked from me time and again on my YouTube channel. So, in this tutorial, I will answer it in detail once and for all.

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

You can call them the three pillars of the Oracle Database. We will talk about Online redo logs and data files in some other tutorial. Today we will focus on Control 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

In short, It contains all the important information about the database without which the proper functioning of the database is impossible.

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

SELECT distinct type FROM v$controlfile_record_section;

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. Don’t worry I will show you how to read a control file. So, don’t worry.

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.

SQL>STARTUP NOMOUNT;

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.

SQL> ALTER database MOUNT;

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.

In order to successfully MOUNT the database, the database instance needs to open and read the control file. Not just only one control file but also all the control files that are listed under CONTROL_FILES initialization parameter.

If any of the control files listed under CONTROL_FILES initialization parameter is missing or not available then you won’t be able to mount the database and recovery is difficult.

I know you must be wondering what is this CONTROL_FILES initialization parameter. We will figure this out in the next tutorial when we will learn “Where the control files are located in Oracle Database?” Till then take care. Thanks and Have a great day.