Managing Control Files- Managing Control Files, Online Redo Logs,and Archivelogs
A control file is a small binary file that stores the following types of information:
• Database name
• Names and locations of data files
• Names and locations of online redo log files
• Current online redo log sequence number
• Checkpoint information
• Names and locations of RMAN backup files
You can query much of the information stored in the control file from data dictionary views. This example displays the types of information stored in the control file querying
Here is a partial listing of the output:
You can view database-related information stored in the control file via the v$database view. The v$ views are based on x$ tables or views, and the v$database is based on an x$ tables, which is just a read of the control file:
SQL> select name, open_mode, created, current_scn from v$database;
Here is the output for this example:
Every Oracle database must have at least one control file. When you start your database in nomount mode, the instance is aware of the location of the control files from the CONTROL_FILES initialization parameter in the spfile or init.ora file. When you issue a STARTUP NOMOUNT command, Oracle reads the parameter file and starts the background processes and allocates memory structures:
At this point, the control files have not been touched by any processes. When you alter your database into mount mode, the control files are read and opened for use:
If any of the control files listed in the CONTROL_FILES initialization parameter are not available, then you cannot mount your database.
When you successfully mount your database, the instance is aware of the locations of the data files and online redo logs but has not yet opened them. After you change your database to open mode, the data files and online redo logs are opened:
Note Keep in mind that when you issue the STARTUP command (with no options), the previously described three phases are automatically performed in this order: nomount, mount, open.When you issue a SHUTDOWN command, the phases are reversed: close the database, unmount the control file, stop the instance.
The control file is created when the database is created. You should create at least two control files when you create your database (to avoid a single point of failure). Control files keep track of important pieces of information for the database, such as detailed data files and online redo logs, log sequence numbers, and checkpoint information.
Losing a control file will require you to recover the control file for the database, and not having a control file as well as not having a backup will make it difficult to recover.
Previously, you should have multiple control files stored on separate storage devices controlled by separate controllers, but because of storage devices, it might be difficult to know if it is a separate device, so it is important to have fault-tolerant devices with mirroring. The control file is an important part of the database and needs to be available or quickly restored if needed.
Control files can also be on ASM disk groups. This allows for one control file in the +ORADATA disk group and another file in +FRA disk group. Managing the control files and details inside remain the same as on the file system except that the control files are just using ASM disk groups.
After the database has been opened, Oracle will frequently write information to the control files, such as when you make any physical modifications (e.g., creating a tablespace, adding/removing/resizing a data file). Oracle writes to all control files specified by the CONTROL_FILES initialization parameter. If Oracle cannot write to one of the control files, an error is thrown:
If one of your control files becomes unavailable, shut down your database, and resolve the issue before restarting. In Chapter 13 we will dive into using RMAN and how to use RMAN to restore a control file. Fixing the problem may mean resolving a storage-device failure or modifying the CONTROL_FILES initialization parameter to remove the control file entry for the control file that is not available.