Managing Control Files
Managing Control Files
Managing Control Files
If a data file exists in the data dictionary but not in the new control file, the
database creates a placeholder entry in the control file under the name MISSINGnnnn,
where N is the file number in decimal. MISSINGnnnn is flagged in the control file as
being offline and requiring media recovery.
Conversely, if a data file listed in the control file is not present in the data dictionary,
then the database removes references to it from the new control file.
If the actual data file corresponding to MISSINGnnnn is read-only or offline normal,
then you can make the data file accessible by renaming MISSINGnnnn to the name of
the actual data file.
If MISSINGnnnn corresponds to a data file that was not read-only or offline normal,
then you cannot use the rename operation to make the data file accessible, because
the data file requires media recovery. In this case, you must drop the tablespace
containing the data file.
10.4.2 Handling Errors During CREATE CONTROLFILE
If Oracle Database sends you an error when you attempt to mount and open the database
after creating a new control file, the most likely cause is that you omitted a file from
the CREATE CONTROLFILE statement or included one that should not have been listed.
Typically, the error is ORA-01173, ORA-01176, ORA-01177, ORA-01215, or ORA-01216. In this case, you
should restore the files you backed up in "Creating New Control Files" and repeat the
procedure in that task, using the correct file names.
10.5 Backing Up Control Files
Use the ALTER DATABASE BACKUP CONTROLFILE statement to back up your control files.
You have two options:
Back up the control file to a binary file (duplicate of existing control file) using the
following statement:
ALTER DATABASE BACKUP CONTROLFILE TO '/oracle/backup/control.bkp';
Produce SQL statements that can later be used to re-create your control file:
ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
This command writes a SQL script to a trace file where it can be captured and edited
to reproduce the control file. View the alert log to determine the name and location
of the trace file.
10.6 Recovering a Control File Using a Current Copy
You can recover your control file from a current backup or from a multiplexed copy.
10.6.1 Recovering from Control File Corruption Using a Control File
If a control file becomes corrupted, then you can recover it using a control file copy.
This method assumes that one of the control files specified in the CONTROL_FILES parameter
is corrupted, that the control file directory is still accessible, and that you have a multiplexed
copy of the control file.
1. With the instance shut down, use an operating system command to overwrite the bad
control file with a good copy:
% cp /u03/oracle/prod/control03.ctl /u02/oracle/prod/control02.ctl
2. Start SQL*Plus and open the database:
SQL> STARTUP
10.6.2 Recovering from Permanent Media Failure Using a Control File
If there is permanent media failure, then you can recover by using a control file copy.
This method assumes that one of the control files specified in the CONTROL_FILES parameter
is inaccessible due to a permanent media failure and that you have a multiplexed copy of
the control file.
1. With the instance shut down, use an operating system command to copy the current copy
of the control file to a new, accessible location:
% cp /u01/oracle/prod/control01.ctl /u04/oracle/prod/control03.ctl
2. Edit the CONTROL_FILES parameter in the initialization parameter file to replace the bad
location with the new location:
CONTROL_FILES = (/u01/oracle/prod/control01.ctl,
/u02/oracle/prod/control02.ctl,
/u04/oracle/prod/control03.ctl)
3. Start SQL*Plus and open the database:
SQL> STARTUP
If you have multiplexed control files, you can get the database started up quickly by editing
the CONTROL_FILES initialization parameter.
10.7 Dropping Control Files
You can drop control files, but the database should have at least two control files at all
times.
You want to drop control files from the database, for example, if the location of a control
file is no longer appropriate.
1. Shut down the database.
2. Edit the CONTROL_FILES parameter in the database initialization parameter file to delete
the old control file name.
3. Restart the database.
Note:
This operation does not physically delete the unwanted control file from the disk. Use
operating system commands to delete the unnecessary file after you have dropped the
control file from the database.
10.8 Control Files Data Dictionary Views
You can query a set of data dictionary views for information about control files.
The following views display information about control files:
View Description
V$DATABASE Displays database information from the control file
NAME
-------------------------------------
/u01/oracle/prod/control01.ctl
/u02/oracle/prod/control02.ctl
/u03/oracle/prod/control03.ctl