Lesson 19
Introduction to RMAN
- A hands-on introduction to RMAN. You will learn what it is and how to make use of basic, critical backup and recovery techniques.
Lesson Objectives
- Introduction to RMAN
- RMAN Components
- Starting and connecting to RMAN
- Basic Operations: Backup
- Basic Operations: Restore, Recover
- Workshop
What is RMAN?...
- Oracle utility for backup, restore and recovery
- Provides server-managed recovery
- Can be used in place of OS copy (user-managed) backup techniques
- Automates many tasks
- Considered easier than user-managed backups?
- Shipped with all versions of Oracle
...What is RMAN?
- Extra cost
- Base software - $0
- Tape (media manager) software
- Limited feature version free from Legato
- Purchase from Legato or Veritas – Big $$$
- Training - ???
- Supports Oracle 8 and up
- Cannot use with version 7 databases
- Command line execution or Graphical UI through Oracle Enterprise Manager
RMAN Components
- RMAN executable
- Client application
- Can run on entirely separate machine
- Starts server sessions on Target Database
- Target Database
- RMAN repository
- Automatic and not optional
- In target database control file
- Optionally also in separate database
- Create a “recovery catalog”
- Keeps complete history of backup and recovery operations
Continuation of Notes
- This is a full page of notes.
- The slide is hidden.
RMAN Components
- Media Management Library
- Required only if backing up to tape
- Communicates with server session on target database
- Reads and Writes to tape
Starting and Connecting...
- Start RMAN from the OS command prompt
...Starting and Connecting
- Start RMAN without parameters
- More secure
- Prevents snooping password with Unix "ps" command
Common RMAN Commands...
- BACKUP
- RESTORE
- RECOVER
- ALLOCATE CHANNEL
- CONFIGURE
- SHOW
...Common RMAN Commands
- REPORT (on target database)
- LIST (backup set info)
- STARTUP, SHUTDOWN
- ALTER DATABASE
- SQL 'sql statement'
- HOST 'os command'
Continuation of Notes
- This is a full page of notes.
- The slide is hidden.
Backup Concepts...
- The BACKUP command is used to backup
- Read entire datafile, writes to specified location
- Creates one or more backup sets
- Remembers name and location of sets
- Each channel creates at least one backup set
- Backupset is the unit of restart
- Start multiple channels and/or use FILESPERSET to create multiple sets
- Also see MAXSETSIZE configuration
...Backup Concepts
- Backup set contains 1 or more pieces
- Backup piece = OS file
- Contains backed up blocks
- Proprietary format
- Can only restore with RMAN RESTORE
- Database must be either mounted or open
- Exception: NOARCHIVELOG database must be mounted (not open)
Full Backup...
- Easy to do full backup of all datafiles, control file and archive logs
- All ever used blocks in datafile are backed up
- Exception: Skips TEMP tablespace
- Skips datafile blocks never used - compression
- The database can be mounted or open
- RMAN detects fractured blocks - auto reread
- No need for Hot backup mode
...Full Backup
Full Tablespace Backup
- Full backup by tablespace
- All blocks ever used are copied to backup
Datafile Backup
- BACKUP command supports one or more datafile names:
Incremental Backup...
- Incremental backup backs up only changed blocks
- Changed since the last incremental or cumulative backup
- Potentially much less data written to backup!
- Implemented with a multiple “level” scheme
- Level 0 backs up ALL blocks
- Level 1 backs up only blocks changed since last 0 or 1
...Incremental Backup
- Sunday start with level 0:
- Monday, Tues, Wed follow with a higher level
Backups – Where to go from here
- Look into:
- Cumulative Incremental
- Image Copy
- Tuning
- Planning
- Backing up to tape – installing the MML
- Monitoring with V$SESSION_LONGOPS, V$SESSION_WAIT
- Metalink Doc ID Note:120084.1
RESTORE Command
- Restore datafiles, control files & archive logs
- Restores to original location by default
- Will overwrite files w/o warning
- Source: backup sets or image copies
- Will not restore if not needed
- Checks location and datafile header
- Does not check for block corruption
- Use FORCE to override
RECOVER Command
- RECOVER Command
- Apply logs or incremental backups to restored file
- Complete recovery
- Incomplete recovery
- Up to specified time, SCN or log sequence number
- See the “SET UNTIL” command
Complete Recovery – Database
- Scenario:
- Recovering all datafiles to most current time, original location
- Control file available, database mounted, not open
Recover Tablespace...
- Scenario:
- Recovering one tablespace to most current time, original location
- Control file available
- Database can be open, tablespace offline
- Determine which tablespace this file is in:
...Recover Tablespace...
- Restore and recover tablespace
- RMAN knows what and where the latest backup is
...Recover Tablespace
- Can use SET NEWNAME to restore to a new location:
Summary: Restore and Recovery
- Study other scenarios:
- Point-in-Time (PIT) recovery
- Recovering the control file
- Tablespace PIT recoveries
- Block-Level recovery
Reporting
- Ways of accessing metadata:
- REPORT command
- Report on backups taken, backups needed
- LIST command
- Report on files such as backup sets and image copies
- SHOW command
- Display CONFIGURE command settings
- SELECT from Recovery Catalog views
Report Need Backup
Show Stored Settings
What Else is There?
- Setting up and using a separate catalog database
- Backing up to tape
- Tuning RMAN
- Duplicating databases for testing
- Creating Standby Databases
- Real Application Cluster support
Getting More Information
- Text book
- Oracle9i RMAN Backup and Recovery
- Freeman, Hart
- ISBN 0-07-222662-5
- Metalink
- Oracle documentation
RMAN Workshop