Beruflich Dokumente
Kultur Dokumente
Steps
- find which files need to restore (from error msg, alert log or
data dictionary views or data recovery advisor)
- depending on the damage, put the database is on nomount, mount
or open mode
- Restore command from RMAN
- Recover command for recovery
- open database
(restore a spfile does not need any recovery command)
Using Data Recovery Advisor (Recovery Advisor as a set of RMAN commands that can
assist you when dealing with media failure)
There are four modes to Data Recovery Advisor:
• Listing failures
• Suggesting corrective action
• Running commands to repair failures
• Changing the status of a failure
• Starting Up
RMAN> startup nomount;
RMAN> alter database mount;
RMAN> alter database open;
Complete Recovery
For complete recovery, the following conditions are necessary:
• database - archivelog mode.
• baseline backup (backup level 0).
• redo logs from last backup.
• All archive redo logs after last backup.
• Any incremental backups after last full back up.
• Online redo logs not archived yet.
Restoring and Recovering Data Files While the Database Is Not Open
In this scenario the database is first shut down and then started
in mount mode. This example shows the restoring of data file 1,
which is associated with the SYSTEM tablespace:
RMAN> rman target /
RMAN> shutdown abort;
RMAN> startup mount;
RMAN> restore datafile 1;
RMAN> recover datafile 1;
RMAN> alter database open;
It is also possbile to specify the file name when performing a
data file recovery:
RMAN> rman target /
RMAN> shutdown abort;
RMAN> startup mount;
RMAN> restore datafile
'/u01/dbfile/o12c/system01.dbf';
RMAN> recover datafile
'/u01/dbfile/o12c/system01.dbf';
RMAN> alter database open;
INCOMPLETE RECOVERY
The term incomplete database recovery means that you can’t recover all
committed transactions. restoring and recovering to a point in time in the past.
For this reason,
incomplete database recovery is also called database point-in-time recovery
(DBPITR)
Incomplete database recovery consists of two :
- restore and
- recovery
The restore process can be initiated from RMAN in a couple of different ways:
• RESTORE DATABASE UNTIL
• FLASHBACK DATABASE
• RESTORE DATABASE UNTIL
following methods can be mentioned:
• Time
• SCN
• Log sequence number
• Restore point
By issuing the RESTORE DATABASE UNTIL command, RMAN will
establish how to extract the data files from any of the following types of backups:
• Full database backup
• Incremental level-0 backup
• Image copy backup generated by the BACKUP AS COPY
command
To view the data file header SCNs and the status of each data
file via this SQL query:
select file#, status, fuzzy, error,
checkpoint_change#,
to_char(checkpoint_time,'dd-mon-rrrr
hh24:mi:ss') as checkpoint_time
from v$datafile_header;
During a recovery, RMAN will automatically determine how to
apply redo:
1. RMAN will apply any incremental backups
available
2. Next, any archived redo log files on disk
will be applied
3. If the archived redo log files do not exist
on disk, then RMAN will attempt to retrieve them from a backup set
Performing Time-Based Recovery
(if you know approximately the time you want to stop the recovery
process, but not a particular SCN.)
The following example specifies a time when issuing
the restore and recover commands:
C:> rman target user/passward
RMAN> startup mount;
• FLASHBACK DATABASE
Flashing Back a Table
oldest_flashback_scn
,to_ch
ar(oldest_flashback_time,'dd-mon-yy hh24:mi:ss')
from
v$flashback_database_log;
Next, the
application performs some testing, after which the database is flashed back to the
restore point so that a new round of testing can begin: