Control file recovery scenarios

What is a control file?

An Oracle control file is a binary file necessary for the database to start and operate successfully. oracle scans the content of the control file in the mount state for the physical location of datafile and redo log files. Oracle continuously updates the control file during the functionality of the database, so it must be available for writing whenever the database is open.If for some reason the control file is not accessible, then the database cannot function properly. Each control file is associated with only one Oracle database.

How to Multiplex the Oracle Control file

Step 1: select the existing control files

Step 2:  shutdown the database

Step 3: copy the existing control file to a new location using cp command

Step 4: Edit the control_files line in pfile

*.control_files=’/u01/TESTDB/control01.ctl’,’/u01/TESTDB/control02.ctl’,’/u01/TESTDB/control03.ctl’,’/u01/TESTDB/control04.ctl’

Step 5: Create a spfile from pfile

Step 6: Start the database

Step 7: Confirm the new control file by querying v$controlfile.

How to remove a control file

Steps for removing a control file is same as the one we followed for multiplexing but on a reverse order.

Step 1: Shut down the database.

Step 2: Edit the control_files section in pfile by removing an entry to control file location.

Step 3: Create an spfile from pfile.

Step 4: Startup the database.

Step 5: Query v$control_file  for confirmation.

How to restore a control file from trace file

Step 1: Create a backup control file

Step 2: Rename the trace file to something with an extension “.sql”

SYS> !cp /u01/app/diag/rdbms/testdb/TESTDB/trace/TESTDB_ora_27204.trc /home/oracle/ctrl.sql

Step 3: Edit the ctrl.sql file for the minimal controlfile information.

cat /home/oracle/ctrl.sql

CREATE CONTROLFILE REUSE DATABASE “MYDB” NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ‘/u01/mydb/redo01.log’ SIZE 50M BLOCKSIZE 512,
GROUP 2 ‘/u01/mydb/redo02.log’ SIZE 50M BLOCKSIZE 512,
GROUP 3 ‘/u01/mydb/redo03.log’ SIZE 50M BLOCKSIZE 512
— STANDBY LOGFILE
DATAFILE
‘/u01/mydb/system01.dbf’,
‘/u01/mydb/sysaux01.dbf’,
‘/u01/mydb/undotbs01.dbf’,
‘/u01/mydb/users01.dbf’
CHARACTER SET WE8MSWIN1252
;

Step 4: startup the database with nomount option.

Step 5: Execute the ctrl.sql file

Step 6: Confirm with v$control_file

 

Words from dbapath

Thank you for giving your valuable time to read the above information. I hope the content served your purpose in reaching out the blog.
Suggestions for improvement of the blog are highly appreciable. Please contact us for any information/suggestion/feedback.

If you want to be updated with all our articles

please follow us on Facebook | Twitter
Please subscribe to our newsletter.