Top Banner
Chapter 7 Making Backups with RMAN
37

Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Dec 28, 2015

Download

Documents

Cora Tyler
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Chapter 7Making Backups with RMAN

Page 2: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Objectives

Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying backup options Channels Output Device types Backup format Tags

Page 3: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Objectives (cont.)

Control file and server parameter file (spfile) Choosing what to back up Flash recovery files Incremental backups Making copies Encryping backups Specifying backup windows Retaining backups Other backup features

Page 4: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Backup Command

Use ‘backup’ command to back up:– Datafiles– Archived redo logs– Control files

Also used to:– Make copies of datafiles– Make backups of backup sets

Page 5: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Backup Command

Basic steps:– Connect to target database– Ensure target database is in proper state

Mount or open for archivelog database Mount for noarchivelog database

– Type ‘backup database’ at the RMAN prompt

Page 6: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Backup Sets & Image Copies

The two types of backups created Backup Set

– Default backup method– Contains one or more backup pieces– One backup piece per backup set by default– Limit piece size with ‘maxpiecesize’ parameter– Limit set size with:

‘maxsetsize’ parameter ‘filesperset’ parameter

– Allows multiplexing (many files in backup set)– Skips backing up unused blocks

Page 7: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Backup Sets & Image Copies (cont.)

Image Copy– Byte for byte image of original file– Can be files not created with RMAN

Incorporated into RMAN via ‘catalog’ command

– Preferred restore method used by RMAN Less overhead than recovery using backup set Can use ‘switch’ command to point database to replacement

file (no actual recovery needed)

Page 8: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

RMAN Backup Modes

Full vs. Incremental– Full

Means all allocated blocks in a given file Is the default backup type

– Incremental has two types Level 0 – same as full Level 1 – Includes only changed blocks since Level 0

Page 9: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

RMAN Backup Modes

Consistent vs. Inconsistent– Consistent –

Occurred in mount state after graceful shutdown No recovery needed Mandatory for noarchivelog databases

– Inconsistent – occurred when database is open or after database crash Recovery always needed For archivelogmode databases

Page 10: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Types of Files RMAN Backs up

Datafiles Control Files Archived Redo logs Image copies of datafiles and control files Backup pieces that contain RMAN backups Server parameter file (spfile) Online redo logs NOT backed up

Page 11: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

RMAN Backup Destinations

Disk directory Media management library (tape device) Flash recovery area

Page 12: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Specifying Backup Options

If overriding configured defaults for:– Channels– Output Device Type– Image Copy or Backup Set Output– Backup Format– Tags for Backup Output

Page 13: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Channels

One disk channel preconfigured For tape

– configure automatic channel, or– Manually allocate tape channel at backup time

Page 14: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Output Device Type

Done using ‘device type’ clause of backup command

Tape devices must be preconfigured to use

Page 15: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Image Copy or Backup Set

Backup set is default For image copy, done using ‘as copy’ clause of

backup command

For backupset, done using ‘as backupset’ clause of backup command

Page 16: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Backup Format

Refers to naming of the RMAN backup files Names specified in the following ways:

– Using ‘format’ clause of backup command– Configure format setting for channel– Configure format setting for device type

If not specified, default names/locations based on O/S specific rules

Page 17: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Tags for Backup Output

Assigns unique name to each backup Done using ‘tag’ parameter of backup command

If not specified, RMAN assigns default tag

Page 18: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Backing Up the Control file

Recommended to use automatic backups of control file– Can restore without control file or recovery catalog– Backed up as standalone backup piece

Placed in default location or flash recovery area Spfile also backed up Can be done manually

– Included in backup for datafile 1

Page 19: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Backing Up the Spfile

Done using backup spfile command Database must be started with spfile Only backs up current spfile Also backed up with control file backup

Page 20: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Backing Up Datafiles

Done via ‘backup datafile’ command Can back up files by name or number Can back up individual datafiles

– Including incremental backups

Use either backup or image copy

Page 21: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Backing Up Tablespaces

Done via ‘backup tablespace’ command Can back up individual tablespaces

– Including incremental backups

Use either backup or image copy

Transportable tablespaces have backup limitations depending on Oracle version

Page 22: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Backing up Whole Database

Done via ‘backup database’ command Backs up all datafiles If autobackup on, will back up control file and spfile Does not back up archived redo logs Backup can be consistent or inconsistent

– Consistent must be taken in mount state after normal shutdown (i.e. – not aborted)

– Inconsistent means backup taken after abnormal shutdown or if database is open

Page 23: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Backing up Archived Redo Logs

Done via ‘backup archivelog’ command

Backs up single copy of each log Can delete O/S file after backup Can backup by location, time, sequence number

Page 24: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Backing up Archived Redo (cont.)

Can be backed up during full database backup When using ‘backup database plus archivelog’

command, the following things occur:1. Alter system archive log current

2. Backup archivelog all

3. The database datafiles are backed up

4. Alter system archive log current (again)

5. Backs up new archive logs generated since backup started

Page 25: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Backing up Everything

Everything means– control file– Datafiles– Archived redo logs– Spfile

Commands to be run:

Verify backups via ‘list backup by file’ command

Page 26: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Backing up Flash Recovery Files

Done via clauses of backup command:– ‘recovery area’ – Db_recovery_file_dest

‘Backup recovery area’ backs up files in flash recovery area

‘backup recovery files’ backs up all disk recovery files, regardless of location

Must specify tape device for flash recovery area files

Page 27: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Flash Recovery Files (cont.)

Includes:– Full and incremental backup sets– control file autobackups– Archived redo logs– Datafile copies

Does not include:– Flashback logs– Current control file– Online redo logs

Page 28: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Performing Incremental Backups

Backs up only changed data– Complete backups within provided windows– Saves storage space– Uses SCN as basis

Two kinds of incremental backups– Differential (default)– Cumulative

Page 29: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Differential Incremental Backups

Is the default for incremental backups Backs up changed blocks since either

– Level 0 backup, or Can be image copies or backup sets

– Level 1 backup Can only be backup sets Faster than level 0 since only changed blocks backed up

Page 30: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Cumulative Incremental Backups

Backs up changed blocks since most recent level-0 backup

Page 31: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Differential vs. Cumulative

Differential incremental backups– Takes less space– Takes longer to recover

Cumulative incremental backups– Takes more space– Takes less time to recover

Page 32: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Incrementals: Things to Remember

You can back up:– Datafile– Datafile Copy– Tablespace– Database

You cannot back up:– control files– Archived redo logs– Backup set

Tips– Use block change tracking to reduce backup time

Page 33: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

RMAN-ski – Making Copies!

Creating Multiple Backup Sets– Done via ‘copies’ or ‘set backup copies’

Making Copies of Backup Sets– Done via ‘backup … backupset’

Making Copies of Image Copies– Done via ‘backup as copy/backupset’

Making Tape Copies of Disk Image Copies– Done via ‘backup datafilecopy’ or backup … copy’

Page 34: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Encrypting RMAN Backups

Two types– Transparent encryption (default encryption mode)– Password encryption

Encryption is turned off by default Steps to use transparent encryption:

– Configuration of Oracle Encryption Wallet– Open the wallet– Use configure command to create encrypted backups

Password encryption done via ‘set encryption’ command Both encryption types can be used at the same time Encryption for database or tablespace backups

Page 35: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Specifying Backup Windows

Done via ‘duration’ parameter of ‘backup’ command Helps backups to run within specified window Can force long backup to stop Helps manage system resources during backup

Page 36: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Retaining Backups

Done via ‘keep’ option of ‘backup’ command Means keeping backups beyond retention policies Also known as ‘archival backups’

Page 37: Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.

Other Backup Features

Exclude tablespaces from a backup Skip read-only, offline, or inaccessible files Can compress backups to save storage Can parallelize backups to save time Can parallel backups of large files Reuse backup files Can backup only files not backed up Can restart backups after a crash Can update image copy backups