Skip to main content

Recreate Control files

We will have to recreate control files due to various reasons.
Corrupted control files
Control files get deleted accidentally etc...


Below are the steps to recreate a control file.



1. sql>alter database backup controlfile to trace noresetlogs;
2. shutdowm immediate
3. startup nomount;
4. create control file from trace file which we created in step one. To do so go to /udump directory and using vi editor open most latest trace log...Copy control file info from Startup mount till what oracle locale is used. then create an empty file using touch controlfile.sql file and paste copied data from trace file. Now we have a controlfile in text format created from trace file
5. rename all original control files to something. (If old control files exists)
6. startup mount
7. @path to controlfile.sql (ignore if says ORA-01081: cannot start already-running ORACLE - shut it down first) at the end it should say file created successfully.
8. recover database
9. alter database open (Thats it...it should open successfully)
10. To make sure all is good....shutdown immediate
11. startup

However if all of your control files were deleted or missing you will have to create that  .sql file using another available Oracle database and edit it according to your current database settings.
Anyway always remember as a best practice to put your 3 control files in 3 different locations (3 disks are better) when you are creating a database.So it'll save you lot of trouble when it comes to situations where your hard disk fails etc.


Note: You can also mention an optional location to backup control file as below.
         
SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE  
        AS '/home/oracle/create_ctl.sql';  



Comments

Popular posts from this blog

Setting ORACLE_SID

The  Oracle System ID  ( S ID ) is used to uniquely identify a particular database on a system How to set ORACLE_SID: Windows: set ORACLE_SID=orcl Unix/ Linux: export ORACLE_SID=orcl SID is case sensitive in Unix / Linux environments. How to check the current ORACLE_SID: Windows: Go to the commnand prompt and type as C:\> set ORACLE_SID (This will show if any ORACLE_SID is already set). C:\> set (To know all the parameters set) Unix/ Linux: echo $ORACLE_SID