|
Category :
Database
Resources -> Backup and Recovery
DB Version
:
Oracle 8i / 9i
OS Details :
Sun Solaris9
One
of the most important part of the database are its control files. Control
files contains the blue print of the database and reflects the
structure of a database at particular points
in time. It contains the checkpoint information, names of log files
and data files, header information of the files and log sequence
number, which is very important for recovery purposes. The recovery is
done by applying the log files whose sequence number is greater than
log sequence number in the control file. The controlfile may also
contain RMAN backup information if RMAN's being used for database
backups. In this article we'll explore in depth some of the details
about the controlfiles.
Control File
Contents:
(1) Datafile information
in control file:
- Names of datafiles with exact path.
- Datafile size information.
- Oracle block size
- Status information on the datafile : Whether the datafile is online
or offline.
- If offline then information on whether the file was taken offline
automatically or not.
- Information on whether the datafile belongs to the system tablespace
or not.
- Entry for each datafile giving a log sequence number when tablespace
was taken offline.
- Stop SCNs.
A little note on stop
SCNs : Every data file header contains as SCN as part of its
structure which is called the START SCNs. Corresponding to every data
file, the control file has a stop SCN. During normal database
operation, the stop SCN in the control file is set to infinity while
the start SCN in the data file header is incremented every time a
checkpoint occurs in the database. When the database is shut down with
the IMMEDIATE or NORMAL option, the checkpoint that happens during the
shutdown process will set the stop SCN in the control file to be the
same as the start SCN in the datafile.
(2) Log file information
in control file:
- Name with exact path.
- File size.
- O/S block size
- Log sequence#
- Information on whether the log file has been archived.
Getting Control File
Details:
- Oracle has provided
options with the <alter database> command which allows us to perform
maintenance tasks against the controlfiles. Using the <alter database>
command, you can make backups of the controlfiles or trace the file
contents in to an editable text file.
- The
V$CONTROLFILE_RECORD_SECTION view allows us to query the various
reusable records sections within the control file and gives
information on the record size, the total number of records allowed
and the number of records used among other information.
- You can use oracle
events to dump the contents of the control file in its current state
on to the oracle trace files. This dump will give us detailed
information about the various sections within the control file. You
can dump the contents by doing this:
SQL> ALTER SESSION
SET EVENTS 'immediate trace name controlf level 3';
Control File
Maintenance:
-
It is critical to mirror the control files as well as have an
effective backup strategy for it.
- The
CONTROL_FILE_RECORD_KEEP_TIME
parameter for the instance controls how much history information
oracle will keep for the reusable records within the control files.
By default,
CONTROL_FILE_RECORD_KEEP_TIME is set to 7 which means that oracle will
maintain reusable records for 7 minimum number of days before it gets
reused. You can reduce this number to decrease the number of records
used within the controlfile but that can potentially also affect your
RMAN backups, restore and maintenance tasks, if you are currently
using RMAN for your database backups
|