Professional Documents
Culture Documents
RMAN
Tanmay Mehrotra
Oracle ACS-SSE
Agenda
RMAN Basics
11gR2 RMAN New Features
Basic Debugging
Tuning RMAN Performance
RMAN Best Practices
RMAN Backup Strategy for VLDB
Q&A
Take Away
Basics
What is RMAN?
Recovery MANager is an Oracle Database client
that performs backup and recovery tasks on your
databases and automates administration of your
backup strategies. It greatly simplifies backing up,
restoring, and recovering database files.
Basics
RMAN Purposes:
Data protection physical backups of your database
Data preservation a copy for year end accounting
Data transfer move a database from one platform to
another
Basics
RMAN Benefits:
Incremental backups that only copy data blocks that have changed since the last backup
Tablespaces are not put in backup mode, thus no extra redo log is generated during online
backups
Detection of corrupt blocks during backup
Parallelisation of I/O operations
Automatic logging of all backup and recovery operations
Built in reporting and listing commands
Integration with Media Management Layer (MML)
Compression
Encryption
Duplication
RMAN
User-Managed
Supported.
Incremental backups
Supported.
Not supported.
Not supported.
Not supported.
Not supported.
Backup repository
Not supported.
Backups to a media
manager
Backup of initialization
parameter file
Supported.
Supported.
Not supported.
Not supported.
Supported.
Not supported.
Platform-independent
language for backups
Supported.
Not supported.
Supported.
Basics
Critical components of RMAN:
RMAN executable
Server processes
Channels
Target database
Backups, backup sets, and backup pieces
Recovery catalog database (optional)
Server
Session
(polling)
MML
Fixed tables
And views
Disk
Server
Session
(channel)
Tape
Media Manager
Recovery
Catalog
DBMS_RCVMAN
DBMS_BACKUP_RESTORE
RMAN
Server
Session
(Catalog)
Target
Controlfile
Tape
Server
Session
(channel)
Target
Database
Files
Basics-The Backupset
There are three types of backup sets:
Data file backup sets
Can include the control files
Can be Incremental or Full backups
Archivelog backup sets
Contains archived log files only
Control File Autobackup
Contains Control file and Spfile
Backup Set 1
Datafile 1
Datafile 3
Control
File
Backup Set 2
Backup Set 3
Datafile 2
Datafile 1
Datafile 1
Datafile 3
Control
File
Datafile 2
Datafile 2
Datafile 4
SPFILE
Datafile 4
SPFILE
Basics-Backup Piece
A backup piece is a file in a backup set.
A backup piece can contain blocks from more
than one datafile.
A backup piece consists of one or more physical
output files contained within a backup set.
Backup Set 1 (Logical)
Piece 1
Datafile 1
Piece 2
Datafile 2
Datafile 4
Basics-Oracle Channels
Tape
Media Manager
Server
Session
(channel)
Target
Database
Files
Allocating Channels
Set various channel limit parameters that apply to
operations performed by the allocated server
session
Force RMAN to create multiple backup pieces.
Prevent RMAN from consuming too much disk bandwidth.
Prevent RMAN from opening too many input files at once.
readrate
Specifies the maximum number of buffers per second read from each
input datafile--prevent RMAN from consuming too much bandwidth
during backups.
maxopenfiles
Parallelizing RMAN
Backup sets are parallelized by allocating multiple
channels or using the configure command for
automatic channel allocation.
Backup Set 1
Datafile 1
Datafile 2
Datafile 3
Backup Set 2
Datafile 4
Datafile 5
Datafile 6
Server
Session
(channel)
Server
Session
(channel)
Media
Manager Tape
Media
Manager Tape
RMAN
backup process
RMAN
backup process
Initial
Terminal
Algorithm Database
Rease
Release
ALGORITHM_DESCRIPTION
Compatible Compatibil Valid
ACO
---------- ---------- --------------------------------------------- ---------- ---------- -------- --10.0.0.0.0
good compression ratio
9.2.0.0.0 10.2.0.3.0 YES
NO
11.2.0.0.0
maximum possible compression speed
11.2.0.0.0 10.2.0.3.0 NO
YES
11.2.0.0.0
balance between speed and compression ratio
11.0.0.0.0 10.2.0.3.0 NO
YES
11.2.0.0.0
maximum possible compression ratio
11.2.0.0.0 10.2.0.3.0 NO
YES
SECTION SIZE
Serially or in parallel
Same size of sections except maybe last section
COMPATIBLE must be 11.0
Max 256 sections
Automatically enabled and no additional installation required
Backup Optimization
Undo backup optimization
Backup failover for arch logs in the flash recovery area
Archived log deletion policy enhancements
# Oracle 10g Syntax.
CONFIGURE ARCHIVELOG DELETION POLICY {CLEAR | TO {APPLIED ON STANDBY | NONE}}
# Oracle 11g Syntax.
ARCHIVELOG DELETION POLICY {CLEAR |
TO {APPLIED ON [ALL] STANDBY |
BACKED UP integer TIMES TO DEVICE TYPE deviceSpecifier |
NONE |
SHIPPED TO [ALL] STANDBY}
Database Duplication
Network-enabled database duplication without
backups
Network-enabled database duplication for standby
without backups
Source database backup not needed on destination
server
RMAN> DUPLICATE TARGET DATABASE [TO dupdb | FOR STANDBY]
DBID 8675309
FROM ACTIVE DATABASE
PASSWORD FILE # (by default will be copied for standby duplication)
SPFILE
PARAMETER_VALUE_CONVERT '/disk1', '/disk2;
SET DB_FILE_NAME_CONVERT '/disk1','/disk2
SET LOG_FILE_NAME_CONVERT '/disk1','/disk2
SET SGA_MAX_SIZE 200M
SET SGA_TARGET 125M
SET DB_UNIQUE_NAME=prdsby
reset dg_broker_start
NOFILENAMECHECK
Long-term Backups
Override the retention policy
Contains all necessary files to restore/recover the
database
RMAN> BACKUP TAG Q107 DATABASE KEEP FOREVER;
RMAN> BACKUP KEEP UNTIL TIME '01-JAN-08' ARCHIVELOG ALL;
RMAN> CHANGE BACKUP OF ARCHIVELOG ALL NOKEEP;
#
#
Dropping VPC
# connect to recovery catalog as VPC owner
$ rman catalog vpc1/vpc1@rcvcat
RMAN> DROP CATALOG;
# If the target database for pre-11g
$ sqlplus vpc1/vpc1@rcvcat
SQL> EXEC RCAT.DBMS_RCVCAT.DROP_VIRTUAL_CATALOG;
# Optionally drop the vpc owner from the database
SQL> conn / as sysdba
SQL> drop user vpc1 cascade;
Change Failure
Other Enhancements
Enhanced TSPITR (dropped TS)
Improved block corruption detection
# Check for physical corruption of all database files.
RMAN> VALIDATE DATABASE;
# Check for physical and logical corruption of a tablespace.
RMAN> VALIDATE CHECK LOGICAL TABLESPACE USERS;
# Check for physical and logical corruption of a datafile.
RMAN> VALIDATE CHECK LOGICAL DATAFILE 4;
# Check for physical corruption of all archived redo logs files.
RMAN> VALIDATE ARCHIVELOG ALL;
# Check for physical and logical corruption of the controlfile.
RMAN> VALIDATE CHECK LOGICAL CURRENT CONTROLFILE;
# Check for physical and logical corruption of a specific backupset.
RMAN> VALIDATE CHECK LOGICAL BACKUPSET 3;
# Check for physical corruption of files to be backed up.
RMAN> BACKUP VALIDATE DATABASE ARCHIVELOG ALL;
# Check for physical and logical corruption of files to be backed up.
RMAN> BACKUP VALIDATE CHECK LOGICAL DATABASE ARCHIVELOG ALL;
# Check for physical corruption of files to be restored.
RMAN> RESTORE VALIDATE DATABASE;
# Check for physical and logical corruption of files to be restored.
RMAN> RESTORE VALIDATE CHECK LOGICAL DATABASE;
Queries
Primary
database
Other Enhancements
SET NEWNAME
10G
SET NEWNAME FOR DATAFILE|TEMPFILE .. TO ..
11G
SET NEWNAME for database {%b, %f, and %U} | tablespace {%b, %f, and %U} | datafile | tempfile
Test
Write Phase
A channel writes the blocks from output buffers to storage media. The
write phase can take either of the following mutually exclusive forms,
depending on the type of backup media:
Write Phase for System Backup Tape (SBT)
Write Phase for Disk
When restoring data, a channel performs these steps in reverse order and
reverses the reading and writing operations.
to
Allocate
Shared
Memory,
Set
These steps are targeted to systems where the available I/O exceeds
100 MB/s, while memory, CPU, network consumption, and tape drive
throughput do not constrain overall RMAN performance. This is
especially true in very high performance configurations, such as
Exadata. In these environments, the default RMAN buffer sizes are
usually inadequate and should be increased.
Q&A
Tanmay.Mehrotra@oracle.com
Take Away
Turn on block checking
To detect corrupt blocks as early as possible
alter system set db_block_checking = true scope=both;
Take Away
Test your backup
The lazy way, but Your backup is only as good as your last restore
restore validate database;
Take Away
Test your recovery
Can avoid multiple restore to get it right during an outage
recover database test_db;
Thank You