You are on page 1of 26

LA Oracle Users Group

Succeeding with RMAN

Tim Gorman
(tim@sagelogix.com)
Principal
SageLogix, Inc.

www.sagelogix.com
Agenda

Is RMAN worth the trouble?


Overview of RMAN architecture
A little bit o history
RMAN in Oracle8
RMAN in Oracle8i
RMAN in Oracle9i
Some things that RMAN still doesnt do well
Doesnt mean it cant do it, but you just have to figure it
out yourself still

www.sagelogix.com
Is RMAN Worth It?
RMAN has a bad rap
Initially well-deserved, but not anymore
Database recovery is too important to rely on ad-
libs during recovery situations
Just about every DBA has written backup scripts
How many have written restore and recovery scripts?
And tested all of them?
Having a query-able database of all backup, restore, and
recovery operations is invaluable for determining
recoverability
Nothing is better than actually testing a restore/recovery,
but RMAN has many almost-as-good features built in

www.sagelogix.com
Architecture Overview
Target database
The database which is being/has been backed up
The RMAN executable connects to the target database like
any other application
RMAN allocates channels which are normal Oracle server
processes to read datafiles and/or archived redo log files
and write them to backup media
Type DISK (default)
Type SBT_TAPE (requires integration with 3rd party
software)
Channels allocated for normal backup/restore/recovery
operations or for explicit catalog maintenance
purposes
Database control files contain the real recovery catalog
A database of all backup, restore, and recovery actions as
well as structural information about the target database

www.sagelogix.com
Architectural Overview
Recovery Catalog database
An optional component
Not required, merely a convenience
Contains data replicated from the real recovery catalog
database in the target databases control files
Used to consolidate RMAN recovery information and enable
certain advanced features
None of the basic backup, restore, or recovery features
require a recovery catalog database
Auxiliary database
Database being created during a DUPLICATE TARGET
DATABASE operations
Target database is the source database being copied
RMAN executable or Backup Manager in OEM
Command-line or GUI console for runnig RMAN commands

www.sagelogix.com
Architectural Overview

Backup media
control
files

online
redo
Backup Manager (OEM)
logfiles MMV
Oracle
server
MMV
Oracle
server Oracle Oracle
data
server server
files
data
RMAN files

Target database Recovery Catalog


RMAN in Oracle8
Introduced in Oracle8 (circa 1997)
Uses server processes to perform backups to disk (default) or
integrated backup media manager (configurable)
No need for FULL block images to redo to prevent
fractured block corruption
As with ALTER TABLESPACE BEGIN/END BACKUP
Backs up database (datafiles, redo logfiles, controlfiles) and
archived redo logfiles
BACKUP or COPY commands
Performs block-level backups
Has incremental backup capability
Performs corruption checking during backup
Server processes perform same block checks as SELECT
statement
Reporting capabilities on all backup, restore, recovery
operations from repository

www.sagelogix.com
RMAN in Oracle8i

Enhanced in Oracle8i
DUPLICATE TARGET DATABASE command added
Create DEV, QA/TEST, or prod scratch databases
from PROD
Cumulative incremental backups added
Reduces restore time at a cost of larger backups
than default differential incremental backups
Crosscheck RMAN catalog with MML catalog or disk
files to expire records
Keeps recovery catalog up-to-date and valid
Fewer commands requiring a separate recovery
catalog database
Complete list in Recovery Manager Users Guide,
page 3-45 in Oracle8i and page 3-13 in Oracle9i
www.sagelogix.com
RMAN in Oracle8i

Trial restores and backups


Reads data from backup media, scans them and
verifies checksums for completeness, but does not
restore to database
RESTORE CONTROLFILE VALIDATE;
RESTORE DATABASE VALIDATE;
RESTORE TABLESPACE VALIDATE;
RESTORE DATAFILE VALIDATE;
RESTORE ARCHIVELOG VALIDATE;
VALIDATE BACKUPSET
Similar BACKUP VALIDATE commands also exist

www.sagelogix.com
Simple database backup
$ rman nocatalog
Recovery Manager: Release 9.2.0.1.0 Production
Copyright 1995, 2002, Oracle Corporation. All rights res
RMAN> connect target sys/manager
Connected to target database: GRDEV1 (DBID=2234098234)
Using target database controlfile instead of recovery cata
RMAN> run {
2> allocate channel t1 type SBT_TAPE;
3> allocate channel t2 type SBT_TAPE;
4> allocate channel t3 type SBT_TAPE;
5> backup incremental level=0 maxsetsize 4G database;
6> release channel t1;
7> release channel t2;
8> release channel t2;
9> }

www.sagelogix.com
Simple archivelog backup
$ rman nocatalog
Recovery Manager: Release 9.2.0.1.0 Production
Copyright 1995, 2002, Oracle Corporation. All rights re
RMAN> connect target sys/manager
Connected to target database: GRDEV1 (DBID=2234098234)
Using target database controlfile instead of recovery cat
RMAN> run {
2> sql alter system switch logfile;
3> allocate channel t1 type SBT_TAPE;
4> backup filesperset 10 archivelog delete input;
5> release channel t1;
6> }

www.sagelogix.com
RMAN everyday tasks

Other typical RMAN responsibilities


Maintain recovery catalog entries
Cross-check against MMV catalog
Delete expired/obsolete entries from
catalog and media
Reporting
Report on redundancy of backups on
backup media
Report on whether anything needs to be
backed up
Report on NOLOGGING activity
www.sagelogix.com
RMAN in Oracle9i

Persistent configuration
Configuration settings stored in control file
Allows simpler everyday command syntax
Defaults for all BACKUP, COPY, RESTORE
operations
CONFIGURE DEFAULT DEVICE TYPE xxx
Where xxx is usually either DISK or SBT (tape)
CONFIGURE DEVICE TYPE xxx [ PARALLELISM n ]
Determines how many channels to allocate by
default

www.sagelogix.com
RMAN in Oracle9i
Persistent configuration (contd)
CONFIGURE CONTROLFILE AUTOBACKUP
[ON|OFF]
Automatically backs up controlfile and SPFILE
After BACKUP, COPY, and other RMAN
commands
After structural changes to database detected
CONFIGURE RETENTION POLICY
TO REDUNDANCY nn
Where nn is the number of complete backups
TO RECOVERY WINDOW OF nn DAYS
Where backups and archived redo logs must be
retained to allow recoveries to any point-in-time
within the nn day recovery window

www.sagelogix.com
RMAN in Oracle9i
SQL> select name, value from v$rman_configuration;

NAME VALUE
----------------------------- --------------------
ARCHIVELOG BACKUP COPIES FOR SBT_TAPE TO 1
DEVICE TYPE
BACKUP OPTIMIZATION OFF
CONTROLFILE AUTOBACKUP ON
CONTROLFILE AUTOBACKUP FORMAT SBT_TAPE
FOR DEVICE TYPE
DATAFILE BACKUP COPIES FOR DE SBT_TAPE TO 1
VICE TYPE
DEFAULT DEVICE TYPE TO SBT_TAPE
DEVICE TYPE SBT_TAPE PARALLELISM 2
MAXSETSIZE TO 4G
RETENTION POLICY TO REDUNDANCY 3

www.sagelogix.com
RMAN in Oracle9i

Oracle9i Server parameter files


(SPFILEs)
Can be automatically backed up with controlfiles
Can be explicitly backed up with:
BACKUP SPFILE
Must be restored with:
RESTORE SPFILE TO [ xxx | PFILE yyy ]

www.sagelogix.com
RMAN in Oracle9i

Improvements in treatment of archived


redo logfiles
BACKUP PLUS ARCHIVELOGS
Automatic log switching prior to any backup of
archivelogs
Convenient
No error message if any backup of archivelogs does not
find any files
Good riddance to a real annoyance
Automatic failover between logfile members if a
sequence is missing
Both a good and a bad thing

www.sagelogix.com
RMAN in Oracle9i

Control files
Use CONFIGURE AUTOBACKUP to automatically
backup controlfiles
Highly recommended!
Controlfiles can be backed up explicitly using:
BACKUP CURRENT CONTROLFILE
BACKUP
DATABASE | TABLESPACE xxx | DATAFILE
xxx
INCLUDE CURRENT CONTROLFILE
If all controlfiles are lost or damaged, can be restored:
RESTORE CONTROLFILE

www.sagelogix.com
RMAN in Oracle9i

Simplified catalog maintenance


commands
DELETE OBSOLETE
Deletes catalog entries and backupset files
according to configured retention policy
DELETE EXPIRED
CROSSCHECK command detects expired
backupset files if missing from backup media
Deletion deletes the entries from recovery
catalog and target database controlfiles

www.sagelogix.com
RMAN in Oracle9i

Block-level media recovery


Instead of restoring and recovering entire datafiles
Blocks being recovered must have already been
identified as corrupt by RMAN
V$BACKUP_CORRUPTION
V$COPY_CORRUPTION
V$DATABASE_BLOCK_CORRUPTION
Allows the database to stay up and available during
restore and recovery
Attempts to access blocks being recovered
results in error message that block is marked
corrupt

www.sagelogix.com
RMAN in Oracle9i

Block-level media recovery (contd)


Typical error indicating corrupt database block:

ORA-01578: ORACLE data block corrupted (file #3,


block #177)
ORA-01110: data file 3:
'/u00/oradata/FDDP/undotbs01.dbf'

Can be restored and recovered with:

BLOCKRECOVER DATAFILE 3 BLOCK 177;

Restrictions:
Can only be performed using a FULL backup
No incremental backups permitted
www.sagelogix.com
RMAN in Oracle9i

Managing disk space during restores


RESTORE DATABASE restores datafiles
RECOVER DATABASE restores archived redo log files
and performs database recovery
In prior versions, this was done in 2 simple steps
Easy to run out of space during recovery
RECOVER DELETE ARCHIVELOG MAXSIZE nnn
Restores nnn Mbytes or Gbytes of archived redo log
files at a time
Uses them for recovery, then deletes them
Until recovery completed

www.sagelogix.com
RMAN in Oracle9i

DUPLICATE TARGET enhancements


SKIP TABLESPACE allows duplication of a subset of
the target database
Remaining (unskipped) tablespaces can be
recovered to a previous point-in-time, if desired
Useful for recovering tablespaces or individual
tables

www.sagelogix.com
Things RMAN doesnt do
The REPORT command leaves much to be
desired
There is a REPORT NEEDS BACKUP, REPORT OBSOLETE,
and REPORT UNRECOVERABLE
But there is no REPORT ISRECOVERABLE yet
And isnt this the most important thing to know?
Must write a custom report against repository to
accomplish this, still
Archived redo log files retention policies are not
supported
RMAN just wants to DELETE INPUT after successful backup
Maybe not a bad thing

www.sagelogix.com
Additional documentation
MetaLink
Note #131865.1 RMAN Library Index
An incredible online resource for RMAN!
Oracle Press
Oracle9i RMAN Backup and Recovery
Robert Freeman, Matthew Hart Oct 2002
Oracle Backup and Recovery 101
Stephen Haisley, Kenny Smith Mar 2002
Oracle8i Backup & Recovery
Rama Velpuri Nov 2000
OReilly and Associates
Oracle RMAN Pocket Reference
Darl Kuhn, Scott Schulze Nov 2001

www.sagelogix.com
Q&A

Slides downloadable from


http://www.EvDBT.com/papers.htm

www.sagelogix.com

You might also like