Control file is a key file in Oracle database architecture. The database is designed to note the important changes in this file, based on the information in control file it operates the database. so what are the contents in control file and what happens if its corrupted or lost?
What does a control file contains? Database as we see doesn’t know the structure like it’s data files / redo logs / backup information.
so It contains:
— Names, and path of the datafiles, log files.
— Database creation time.
— Log sequence number.
— And also check point information.
Database changes are recorded in the control file in the form of SCN, and redo log sequence information. When the database opens it cross verifies datafile header information with control file to make sure all the datafiles are accessible and are in sync with the stored information.
The rows and information in v$database is populated using the control file information. The other data dictionary views to see the control file information are these:
— v$controlfile
— v$controlfile_record_section
Recommended control files for a database are 2, if you create a database using dbca you see 2 control files. But I recommend to have at least 3 control files, due to its importance in the whole database operations. I saw production dba crashed and loss of information due to in appropriate structures and backups. We can’t imagine a loss of information on a sensitive database.
Loss of control file:
How do we recover database with a loss of control file?
Instance throws error ORA-00205 error and it won’t mount. In this case either you need a backup copy of control file or if you don’t have you need to create a control file.
Eg: CREATE CONTROLFILE REUSE DB_UNIQUE_NAME RESETLOGS(NORESETLOGS if all the logs are available)
…
..
Control file records the header information listed in the create control file script. Open the database and backup the control file.If you backup the control file to trace, you can see the imp contents in the file. It’s helpful to re-create the control file with all the datafiles.
Eg: ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
— Archive log information.
— Standby information.
— Controlfile creation script.
— Required archive log information.
Backup controlfile: ALTER DATABASE CONTROLFILE TO ‘/BACKUP/contr_bkp.ctl’;
RMAN without catalog connection records the backup information in the control file, if you lost the file then there is no way to get the backup details other than re-registering backup sets manually. Control file and standby database, standby database is a constant recovery database. Here MRP process recovers the database and sync with the primary database. Standby control file play an important role here. It gives the information like next log to apply, and recovery information so on.