Database Reference
In-Depth Information
Most situations in which you need to restore and recover will not be as bad as the one just described. However,
the previous scenario does highlight the need for
a backup strategy
a DBA with B&R skills
a restore-and-recovery strategy, including a requirement to test the restore and recovery
periodically
This chapter walks you through restore and recovery, using RMAN. The chapter covers many of the common
tasks you will have to perform when dealing with media failures.
Determining if Media Recovery Is Required
The term media recovery means the restoration of files that have been lost or damaged, owing to the failure of the
underlying storage media (usually a disk of some sort) or accidental removal of files. Usually, you know that media
recovery is required through an error such as the following:
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/dbfile/O12C/system01.dbf'
The error may be displayed on your screen when performing DBA tasks, such as stopping and starting the
database. Or, you might see such an error in a trace file or the alert.log file. If you don't notice the issue right away,
with a severe media failure, the database will stop processing transactions, and users will start calling you.
To understand how Oracle determines that media recovery is required, you must first understand how Oracle
determines that everything is okay. When Oracle shuts down normally ( IMMEDIATE , TRANSACTIONAL , NORMAL ), part of
the shutdown process is to flush all modified blocks (in memory) to disk, mark the header of each data file with the
current SCN, and update the control file with the current SCN information.
Upon startup, Oracle checks to see if the SCN in the control file matches the SCN in the header of the data files. If
there is a match, then Oracle attempts to open the data files and online redo log files. If all files are available and can
be opened, Oracle starts normally. The following query compares the SCN in the control file (for each data file) with
the SCN in the data file header:
SET LINES 132
COL name FORM a40
COL status FORM A8
COL file# FORM 9999
COL control_file_SCN FORM 999999999999999
COL datafile_SCN FORM 999999999999999
--
SELECT
a.name
,a.status
,a.file#
,a.checkpoint_change# control_file_SCN
,b.checkpoint_change# datafile_SCN
,CASE
WHEN ((a.checkpoint_change# - b.checkpoint_change#) = 0) THEN 'Startup Normal'
WHEN ((b.checkpoint_change#) = 0) THEN 'File Missing?'
WHEN ((a.checkpoint_change# - b.checkpoint_change#) > 0) THEN 'Media Rec. Req.'
 
Search WWH ::




Custom Search