chapter 7 making backups with rman. objectives explain backup sets and image copies rman backup...
TRANSCRIPT
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
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
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
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
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
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)
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
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
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
Specifying Backup Options
If overriding configured defaults for:– Channels– Output Device Type– Image Copy or Backup Set Output– Backup Format– Tags for Backup Output
Channels
One disk channel preconfigured For tape
– configure automatic channel, or– Manually allocate tape channel at backup time
Output Device Type
Done using ‘device type’ clause of backup command
Tape devices must be preconfigured to use
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
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
Tags for Backup Output
Assigns unique name to each backup Done using ‘tag’ parameter of backup command
If not specified, RMAN assigns default tag
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
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
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
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
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
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
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
Backing up Everything
Everything means– control file– Datafiles– Archived redo logs– Spfile
Commands to be run:
Verify backups via ‘list backup by file’ command
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
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
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
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
Differential vs. Cumulative
Differential incremental backups– Takes less space– Takes longer to recover
Cumulative incremental backups– Takes more space– Takes less time to recover
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
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’
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
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
Retaining Backups
Done via ‘keep’ option of ‘backup’ command Means keeping backups beyond retention policies Also known as ‘archival backups’
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