Upload
taya-reade
View
216
Download
3
Tags:
Embed Size (px)
Citation preview
www.sagelogix.com
LA Oracle Users GroupLA Oracle Users Group
Succeeding with RMAN
Tim Gorman([email protected])
PrincipalSageLogix, Inc.
www.sagelogix.com
AgendaAgenda
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 doesn’t do wellDoesn’t mean it can’t do it, but you just have to figure it out yourself still…
www.sagelogix.com
Is RMAN Worth It?Is RMAN Worth It?
RMAN has a bad rapInitially 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 OverviewArchitecture Overview
Target databaseThe database which is being/has been backed upThe 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 catalogA database of all backup, restore, and recovery actions as well as structural information about the target database
www.sagelogix.com
Architectural OverviewArchitectural Overview
Recovery Catalog databaseAn optional component
Not required, merely a convenienceContains data replicated from the real recovery catalog database in the target database’s control filesUsed 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 databaseDatabase being created during a DUPLICATE TARGET DATABASE operations
Target database is the source database being copied
RMAN executable or Backup Manager in OEMCommand-line or GUI console for runnig RMAN commands
Architectural Overview
Architectural Overview
datafiles
datafiles
onlineredologfiles
controlfiles
Oracleserver
RMAN
Oracleserver
Backup Manager (OEM)
Oracleserver
Oracleserver
Target database Recovery Catalog
Backup media
MMV
MMV
www.sagelogix.com
RMAN in Oracle8RMAN 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 BACKUPBacks up database (datafiles, redo logfiles, controlfiles) and archived redo logfiles
BACKUP or COPY commandsPerforms block-level backups
Has incremental backup capabilityPerforms 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 Oracle8iRMAN in Oracle8i
Enhanced in Oracle8iDUPLICATE 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 User’s Guide, page 3-45 in Oracle8i and page 3-13 in Oracle9i
www.sagelogix.com
RMAN in Oracle8iRMAN in Oracle8i
Trial restores and backupsReads 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
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
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 tasksRMAN everyday tasks
Other typical RMAN responsibilitiesMaintain 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 Oracle9iRMAN in Oracle9i
Persistent configurationConfiguration 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 Oracle9iRMAN in Oracle9i
Persistent configuration (cont’d)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 POLICYTO REDUNDANCY nn
Where nn is the number of complete backupsTO 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 Oracle9iRMAN in Oracle9i
SQL> select name, value from v$rman_configuration;
NAME VALUE----------------------------- --------------------ARCHIVELOG BACKUP COPIES FOR ‘SBT_TAPE’ TO 1DEVICE TYPEBACKUP OPTIMIZATION OFFCONTROLFILE AUTOBACKUP ONCONTROLFILE AUTOBACKUP FORMAT ‘SBT_TAPE’FOR DEVICE TYPEDATAFILE BACKUP COPIES FOR DE ‘SBT_TAPE’ TO 1VICE TYPEDEFAULT DEVICE TYPE TO ‘SBT_TAPE’ DEVICE TYPE ‘SBT_TAPE’ PARALLELISM 2MAXSETSIZE TO 4GRETENTION POLICY TO REDUNDANCY 3
www.sagelogix.com
RMAN in Oracle9iRMAN 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 Oracle9iRMAN 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 Oracle9iRMAN in Oracle9i
Control filesUse 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 Oracle9iRMAN 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 Oracle9iRMAN in Oracle9i
Block-level media recoveryInstead 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 Oracle9iRMAN in Oracle9i
Block-level media recovery (cont’d)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 Oracle9iRMAN in Oracle9i
Managing disk space during restoresRESTORE 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 Oracle9iRMAN in Oracle9i
DUPLICATE TARGET enhancementsSKIP 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 doesn’t do
Things RMAN doesn’t 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 isn’t 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
Additional documentation
MetaLinkNote #131865.1 “RMAN Library Index”
An incredible online resource for RMAN!
Oracle PressOracle9i 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
O’Reilly and AssociatesOracle RMAN Pocket Reference
Darl Kuhn, Scott Schulze – Nov 2001
www.sagelogix.com
Q&AQ&A
Slides downloadable fromhttp://www.EvDBT.com/papers.htm