0% found this document useful (0 votes)
29 views6 pages

Step by Step Control File Recovery

Uploaded by

Jaya singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views6 pages

Step by Step Control File Recovery

Uploaded by

Jaya singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Here are the steps to restore a control file in different scenarios:

1. Restoring Control File from RMAN Backup

If you have an RMAN backup, follow these steps:

Step 1: Connect to RMAN

Connect to the RMAN utility as the Oracle user with SYSDBA privileges.

Command:

rman target /

Step 2: Start the Database in NOMOUNT Mode

Since the control file is not available, the database must be started in NOMOUNT mode.

Command:

STARTUP NOMOUNT;

Step 3: Restore the Control File

Restore the control file from the RMAN backup.

rman

RESTORE CONTROLFILE FROM '/path/to/backup/controlfile.bkp';

Alternatively, if you are using a recovery catalog or the control file autobackup feature, RMAN can
automatically restore the most recent control file backup:

rman

RESTORE CONTROLFILE FROM AUTOBACKUP;

Step 4: Mount the Database

After restoring the control file, mount the database to make it accessible to further recovery operations.

rman

ALTER DATABASE MOUNT;

Step 5: Recover the Database


After restoring the control file, you need to recover the database (apply archived logs, redo logs, or
backups):

rman

RECOVER DATABASE;

Step 6: Open the Database

Once the recovery is complete, open the database normally.

rman

ALTER DATABASE OPEN RESETLOGS;

2. Restoring Control File Manually (Without RMAN)

If you don't have RMAN backups but have a copy of the control file (either from a backup or another
mirrored location), follow these steps:

Step 1: Shutdown the Database (If Necessary)

If the database is running, shut it down.

sql

SHUTDOWN IMMEDIATE;

Step 2: Copy the Control File

If you have a manual backup of the control file (e.g., from a cold backup or another mirrored control file
location), copy it back to its original location.

For example:

Command

cp /backup/controlfile.ctl /u01/app/oracle/oradata/mydb/control01.ctl

If multiple control files were configured, you can restore them all to their respective locations.

Step 3: Start the Database in NOMOUNT Mode

Start the database in NOMOUNT mode, as the control file is required to mount the database.

sql

STARTUP NOMOUNT;
Step 4: Mount the Database

After replacing the control file, mount the database.

sql

ALTER DATABASE MOUNT;

Step 5: Recover the Database (If Necessary)

If required, recover the database by applying the archived redo logs.

sql

RECOVER DATABASE;

Step 6: Open the Database

Open the database in normal mode. If the control file was replaced or if it was restored from an old
backup, you must use RESETLOGS to open the database.

sql

ALTER DATABASE OPEN RESETLOGS;

3. Restoring Control File in a Data Guard Environment

If the control file is lost in a Data Guard standby environment, follow these steps:

Step 1: Create a Standby Control File from Primary

On the primary database, create a control file for standby recovery:

sql

ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/tmp/standby_controlfile.ctl';

Step 2: Transfer the Standby Control File

Transfer the newly created standby control file to the standby database server.

Command

scp /tmp/standby_controlfile.ctl
standby_user@standby_server:/u01/app/oracle/oradata/standby/control01.ctl
Step 3: Replace the Control File on Standby

On the standby server, replace the old control file with the newly transferred control file.

Step 4: Start the Standby Database in NOMOUNT Mode

Start the standby database in NOMOUNT mode.

sql

STARTUP NOMOUNT;

Step 5: Mount the Standby Database

Mount the standby database.

sql

ALTER DATABASE MOUNT STANDBY DATABASE;

Step 6: Start Managed Recovery

Start the managed recovery process.

sql

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;

4. Restoring Control File Using Control File Trace

If there is no RMAN backup but you have a control file trace (controlfile trace), you can recreate
the control file:

Step 1: Get the Control File Trace

Look for the control file trace in the alert log or the USER_DUMP_DEST directory. Oracle automatically
generates a control file trace upon database creation or other control file-related operations.

Step 2: Modify the Trace File

Open the trace file and remove unnecessary lines (e.g., comments). Modify it according to your
environment, especially the file paths of the datafiles, redo log files, and control files.

Step 3: Shut Down the Database


Shutdown the database if it's running.

sql

SHUTDOWN IMMEDIATE;

Step 4: Start the Database in NOMOUNT Mode

Start the database in NOMOUNT mode.

sql

STARTUP NOMOUNT;

Step 5: Run the Modified Script

Run the modified control file trace script to recreate the control file.

sql

@/path/to/modified_controlfile_trace.sql

Step 6: Recover the Database

After creating the control file, recover the database if necessary.

sql

RECOVER DATABASE;

Step 7: Open the Database

Finally, open the database using RESETLOGS.

sql

ALTER DATABASE OPEN RESETLOGS;


Summary of Key Commands:

1. Restore from RMAN:

rman

RESTORE CONTROLFILE FROM AUTOBACKUP;

2. Manual Restore:

Command

cp /backup/controlfile.ctl /u01/app/oracle/oradata/mydb/control01.ctl

3. Create a Standby Control File:

sql

ALTER DATABASE CREATE STANDBY CONTROLFILE AS


'/path/to/standby_controlfile.ctl';

4. Recreate Control File from Trace:

sql

@/path/to/modified_controlfile_trace.sql

Conclusion

Restoring the control file is an essential step in database recovery, whether you are restoring from RMAN
backups, manually copying a backup control file, or using a control file trace. Always ensure the control
file is restored properly and that the database is in sync with the redo logs and datafiles before opening
the database.

You might also like