Professional Documents
Culture Documents
Recovery MANager
Oracles Backup and Recovery Tool
Recovery MANager
RMAN permits restartable backups if you have a specific time window within
which backups are permitted
RMAN has a command-line interface (rman) and is also integrated with Grid Control
4
Backup Sets are logical groupings of backed-up database files
Backup sets have a unique ID and may have a TAG for RMAN identification
Backup sets consist of one or more individual files called backup pieces.
Backup piece files contain the data blocks from a backup
Backup Sets
RMAN recovery using Backup Sets
The recovery process identifies the target SCN or date to which to recover
Needed blocks are retrieved from the appropriate backup set pieces
Data files are reconstructed from the needed blocks
5
6
A stream of data to a device using one server session
Server session performs the backup, restore and recovery
Channels can be configured with device-specific settings
Channels are automatically allocated, or manually allocated
Channels
RUN { BACKUP DATAFILE 3;
ALLOCATERESTORE
CHANNEL c1 DEVICE users;
TABLESPACE TYPE sbt;
BACKUP DATABASE PLUS ARCHIVELOG;
}
7
RMAN> CONFIGURE DEVICE TYPE sbt PARALLELISM 1;
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO sbt;
RMAN>TwoCONFIGURE CHANNEL
types of device DEVICE
type disk TYPE sbt PARMS
and sbt
RMAN
MediahasManager vendors
an open
'ENV=(NSR_SERVER=bksvr1)'; API forhave specific
communicating
installation
with Tape andinstructions thatmanager
other media vary by vendor
RMAN>Refer
BACKUP DATABASE;
to vendors for detailed installation
software
and
RMANusesends
instructions
labeled streams of bytes to the
media manager during backup
The labeled streams are returned by the
media manager during RMAN restore
operations
8
Backup Set
RMAN-proprietary storage of backed-up data blocks
Consist of a Backup Set identifier plus associated backup set files or pieces
Can only be restored using RMAN
Image Copy
Equivalent to file copies of original database files
RMAN considers user-managed backups as Image Copies
Contain ALL data blocks no compression
9
Backup sets or image copies can be labeled with a text TAG
RMAN commands can select backup sets or copies using the TAG
10
Full backup
Backup of all specified database file blocks
Independent of when database files were last backed up
Not used in incremental backup strategies
Incremental backup
Backup of blocks changed since last incremental backup Full backup is
SCN used to identify changed blocks equivalent to
Level 0 incremental backup incremental level 0
Level 1 incremental backup
11
Level 0 incremental backups
Backup of all blocks in specified database files
Independent of when files were last backed up
Base for subsequent Level 1 backups
12
Level 1 incremental backups
Differential backup
Contain all blocks changed after the most
recent incremental backup at level 1 or 0
Differential backups remain smaller and quicker to perform
Differential backups are slower to restore requiring changes
in multiple earlier incremental backups
Cumulative backup
Contain all blocks changed after the most
recent incremental backup at level 0
Cumulative backups become much larger over time
Cumulative backups are quicker to restore
13
RMAN can report, validate, remove or protect backup files
RMAN can use a Block Change Tracking file to identify changed blocks
Bitmap file created automatically by Level 0 backup if configured
RMAN can now avoid rescanning database files for changed blocks
(blocks with newer SCN than in previous backup sets)
Loss of change tracking file is harmless recreated by next Level 0
15
RMAN does not automatically enforce your retention policies
16
Increasing backup set size and backup duration
Faster recovery
17
Consistent backup set size and backup duration
Slower recovery using more backup sets
18
A. Monthly Full Level 0 Incremental backup
B. Weekly Level 1 Cumulative Incremental backup
C. Daily Level 1 Differential Incremental backup
Advantages
RMAN doesnt have to apply more than a few days worth of
differential backups to the latest cumulative backup and the original
level 0 backup
No more than 1 day of redo logs need to be applied during recovery
Disadvantages
May not meet with your MTTR target (Mean-Time-to-Recovery)
Rule of Thumb:
You should perform a new Level 0 backup
once >50% of blocks have changed
19
Allocating multiple channels for a device type allows parallel completion of
RMAN tasks
If a channel fails, surviving channels will attempt to complete the restore job
RUN
{
ALLOCATE CHANNEL c1 DEVICE TYPE sbt;
ALLOCATE CHANNEL c2 DEVICE TYPE sbt;
ALLOCATE CHANNEL c3 DEVICE TYPE sbt;
BACKUP DATAFILE 5,6,7;
}
20
21
Two Steps:
RESTORE
Missing files are restored from the blocks in backup sets OR
Image copies are copied to the original (or new) file locations
Unmodified files not modified can be skipped by RMAN automatically
RMAN uses the record of available backups in the RMAN repository to select the
best available backups for use in the restore operation.
The most recent backup available, or the most recent backup satisfying any
UNTIL clause specified in the RESTORE command, is always the preferred choice
If two backups are from the same point in time, RMAN prefers image copies
over backup sets because RMAN image copy restores are faster
RECOVER
Recovery must be performed for incomplete backups
Archive logs are applied to the database
22
23
Reusable lists of RMAN commands
Stored on the file system or in the RMAN respository
Not the Control file!
LOCAL scripts used by a single database instance
script
GLOBAL scripts shared by database instances in repository
## create
createsrecovery
recoverycatalog
catalogscript
scripttotoback
backupupdatabase
databaseand
andarchived
archivedlogs
logs
CREATE
CREATE SCRIPT
GLOBALbackup_whole
SCRIPT global_backup_db
COMMENT
COMMENT "backup
"backup whole database
any database andthe
from logs"
recovery catalog, with logs"
{{
BACKUPDATABASE
BACKUP INCREMENTAL
PLUSLEVEL 0 TAG b_whole_l0
ARCHIVELOG;
} DATABASE PLUS ARCHIVELOG;
}
24
Execute a command on the local host from within RMAN
host
host dd if=/orabak/tools.dbf of=/oradata/tools.dbf
25
Execute a SQL command on the Target database within RMAN
sql
sql alter system archive log current;
26
list / report
crosscheck
validate
delete
27
List all backup sets and pieces known by RMAN
28
Verifies existence of known backup file sets and pieces in
the RMAN repository
Marks backup file sets and pieces as expired if they
exceed retention policies
crosscheck
CROSSCHECK doesnt physically delete anything!
29
Verifies existence and availability of database file media
validate
Damaged backup file media may be repaired using Block
Media Recovery
30
Remove any or all database backup file media from disk/tape
and RMAN repository
Can remove obsolete media no longer needed to recover
under retention policies
delete
DELETE BACKUP TAG='before_upgrade'; # delete backup based on tag
DELETE NOPROMPT ARCHIVELOG ALL; # delete all archivelogs
DELETE EXPIRED BACKUP; # delete expired after crosscheck
DELETE BACKUP; # delete ALL backups
31
32
It is easier to show RMAN (and not just talk about it endlessly )
rman
rman>> connect target system/pswd@sid1
33
Uses defaultbackup
device typedatabase;
setting (SBT or Disk)
Creates device channels according to parallelism setting
Creates image copies or backup sets
Might not backup controlfile automatically!
Doesnt backup archivelogs
Inconsistent database backup including
archive logs
show controlfile autobackup
configure controlfile autobackup on
show {parameter|ALL}
configure {parameter} clear
configure {parameter} {newsetting}
restore and recover
Parallel backup of regions of BIG datafiles
RMAN
New encryption 11g Features
algorithm
Data Recovery Advisor 11g
Online backup of standby databases
Virtual, secure and mergeable RMAN catalogs
Encrypted disk backup sets
40
Oracle Database Backup and Recovery Basics
10g Release 2 (10.2)
http://download.oracle.com/docs/cd/B19306_01/backup.102/b14192/bkup004.htm#sthref385
41