Loss of Control Files
Published by : Obay Salah , November 19, 2024
In this scenario, imagine that you have lost all the Control Files. Of course, the database does not work without the Control File. If you had lost one of the Control Files, the matter would have been easy. We make a copy of one of the existing Control Files and put it in place of the lost file.
But here we have lost all the Control Files, of course the database will stop working and if it does not stop it must be stopped immediately (Shut Abort) until
a quick procedure is done to save the database.
In such a scenario, there are two options for rescue:-
The first option:
We create a new Control File using the code Create Controlfile, with the help of the Trace Control File if it exists, and it is better for the database administrator
to do a Backup Trace To Controlfile whenever he changes the structure of the database so that he can benefit from the Trace file in creating the File Control later
In the event that he loses all the files Control Files, but even if the database administrator does not do this, he can create the Control File by
writing the code manually according to the database structure.
In general, the database administrator can do Backup Controlfile To Trace.
ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
This procedure produces a Trace File, which is a text file containing the code to create the Control File that can be used later to create the Control File when we need to.
This file is located in the path specified in the USER_DUMP_DEST variable.
Here are the steps to create the Control File:
1- Run the database in NOMOUNT mode.
STARTUP NOMOUNT;
2- We write or prepare the code to create the Control File from the Trace file, if any, or write it manually. Here is an example of a file containing the code to create the Control File. I copied it from the Trace File and saved it in a file called CONT.SQL.
3- We execute the above code as in Figure but the code must be executed while we are in NOMOUNT mode.
@C:\CONT.SQL
4- Then we open the database in RESETLOGS mode.
ALTER DATABASE OPEN RESETLOGS;
Second option: -
Here we restore the File Control file from the backup.
1- We restore the Control File files from the backup.
2- Then we open the database in MOUNT mode
STARTUP MOUNT
3- Then we do Recovery.
RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCCEL;
Note that after starting the recovery process, we may need to select the Redolog Files to complete the recovery process or do it automatically by typing the AUTO option.
There is another option, CANCEL, to end the recovery process, but if you type Redolog File, we repeat the step again by specifying the other Redolog Files.
[Must be current Redolog file , else repeat this steps with other Redolog groups member]
4- Finally, we open the database in RESETLOGS mode.
ALTER DATABASE OPEN RESETLOGS;
Comments
no comment yet!