Databases Reference
In-Depth Information
When you start your database, Oracle uses the SCN information in the control files and data file headers to
determine which one of the following will occur:
Starting up normally
Performing crash recovery
Determining that media recovery is required
On startup, Oracle checks the instance thread status to determine whether crash recovery is required. When
the database is open for normal operations, the thread status is OPEN . When Oracle is shut down normally (normal,
immediate, or transactional), a checkpoint takes place, and the instance thread status is set to CLOSED .
When your instance abnormally terminates (such as from a shutdown abort command), the thread status
remains OPEN because Oracle didn't get a chance to update the status to CLOSED . On startup, when Oracle detects that
an instance thread was abnormally left open, the system monitor process will automatically perform crash recovery.
The following query demonstrates how a single instance of Oracle would determine whether crash recovery is
required. Your database needs to be at least mounted to run this query:
SELECT
a.thread#, b.open_mode, a.status,
CASE
WHEN ((b.open_mode='MOUNTED') AND (a.status='OPEN')) THEN
'Crash Recovery req.'
WHEN ((b.open_mode='MOUNTED') AND (a.status='CLOSED')) THEN
'No Crash Rec. req.'
WHEN ((b.open_mode='READ WRITE') AND (a.status='OPEN')) THEN
'Inst. already open'
WHEN ((b.open_mode='READ ONLY') AND (a.status='CLOSED')) THEN
'Inst. open read only'
ELSE 'huh?'
END STATUS
FROM v$thread a
,gv$database b
WHERE a.thread# = b.inst_id;
Oracle will start up normally if the SCN information in the control files matches the SCNs in the corresponding
data files. If the checkpoint SCN in the data file is less than the corresponding SCN in the control file, Oracle will throw
a media recovery error. For example, if you restored a data file from a backup, Oracle would detect that the SCN in
the data file is less than the corresponding SCN in the control file. Therefore, a recovery is required to apply changes
to the data file to catch it up to the SCN in the control file. Table 11-1 summarizes the checks that Oracle performs to
determine whether crash or media recovery is required.
Table 11-1. SCN Oracle Startup Checks
Condition on Startup
Oracle Behavior
DBA Action
CF checkpoint SCN < Data file
checkpoint SCN
“Control file too
old” error
Restore a newer control file or recover with the
using backup controlfile clause.
CF checkpoint SCN > Data file
checkpoint SCN
Media recovery
required
Most likely a data file has been restored from
a backup. Recovery is now required.
CF checkpoint SCN = Data file SCN
Start up normally
None
Database in mount mode, instance
thread status = OPEN
Crash recovery
required
None. Oracle automatically performs crash
recovery.
 
 
Search WWH ::




Custom Search