ࡱ> ݀(   6"www.SageLogix.ComH4http://metalink.oracle.com$/ 00DTimes New Romanv 0( 0DArialNew Romanv 0( 0" DComic Sans MSnv 0( 0gB0DCourier NewSnv 0( 01c .@  @@``  @n?" dd@  @@``  _$    $*L #a*+,   ,,' -;/  a  "()+ !"#$ b T=? f3t&4nC@g4;d;dv 0ppp@  <4!d!d 0L<4BdBd 0LMʚ;K,,ʚ;<4dddd{ 0:2___PPT9/ 0? %O =rg www.SageLogix.Comf3!0AgendaRMAN architecture So what s the hassle? What makes it worthwhile? Standardized backup/recovery strategy Three features that only RMAN has Are these features important to you? If so, RMAN is worth the hassle. Just do it! If not, don t worry - be happy!\B`H`%`N`BH%NRMAN Architecture BasicsTarget database the database which is to be backed up, restored, or recovered Recovery catalog database the database containing the recovery catalog, which contains information facilitate RMAN operations all backup, restore, and recoveries database structure (replicated from target s control files) Recovery catalog is optional; all of the basic and most important RMAN operations can be performed with only the information stored in the target database s control files recovery catalog database != target database !!!!!>d`>8`RMAN Architecture Basics 8RMAN Architecture Basics  RMAN Architecture Basics&Oracle server processes perform RMAN operations processes issue consistent-read requests to database and write data out to (or read data from) the RMAN application programming interface (API) Media-management vendors (MMVs) implement the RMAN API most platforms use a dynamically-linked library (DLL) architecture these are separate executable files which are invoked only on demand on Solaris, the LD_LIBRARY_PATH environment variable directs the  oracle executable to find the  libobk.so shared-link-object (written by the MMV)0ZZ7ZCZEZZ0;      -!*So what s the hassle?`It s (relatively!) new it s predecessor (Oracle7 EBU) was poorly designed there have been serious bugs, mostly prior to 8.0.5 counterpoint: it s been generally available since 1997 It s unfamiliar it seems complicated (it s not!) it has it s own scripting language to learn and some new concepts to master People trust their existing homegrown scripts or other 3rd-party products BMC SQL*Backtrack is an excellent competing productg8mJ4 C '  m   4"*So what s the hassle?VRMAN installation can be a pain this is true; linking the MMV software can be frustrating, due to version-compatibility issues now we re mixing and matching versions, bugs, patches, and upgrades from two software vendors instead of just one& As recently as 2-3 years ago, the typical RMAN installation has sometimes involved days or weeks of efforts to: acquire appropriate compatible software versions configure MMV software debugging RMAN and MMV glitches Learning the  RMAN way of doing things No longer true for mainstream MMVs Veritas, Legato, ADSM Z`ZsZpZZ#ZZ TI&p  # #What makes it worth it? Forget the GUI packaging hype and the bells-and-whistles and hype about  ease of use Every other competing product has the same stuff! But  one-click or  one-command restore-and-recovery is a nice thing at 2:30am on Sunday morning! What is really important to consider is that RMAN does three things better than any other solution: 1.  hot backups without the need for the ALTER TABLESPACE xxx BEGIN/END BACKUP commands (only RMAN can do this!) 2. Incremental backups 3. Detection of corrupted database blocks during backupVZ2ZdZdZZV2d7    !  ZQ$4 Hot backups: the old way$:Tablespaces must be put into BACKUP mode ALTER TABLESPACE xxx BEGIN BACKUP datafile headers are frozen database blocks continue to be written down by DBWR nothing is  stored anywhere else while the backup is in-progress (a popular misconception) initial changes to blocks (after BEGIN BACKUP) cause entire block image to be written to redo logs, instead of just the data being changed subsequent changes to blocks are normal vectors only ALTER TABLESPACE xxx END BACKUP CKPT continues writing to datafile headers normal redo logging resumes)"P\5 G)"5\Y    )  5 G,:R%4 Hot backups: the old way$ &4 Hot backups: the old way$ '4 Hot backups: the old way$ (4 Hot backups: the old way$  )4 Hot backups: the old way$  *4 Hot backups: the old way$  +4 Hot backups: the old way$While a tablespace is in BACKUP mode, we are purposely copying in-flux datafiles! Changes are being made to the datafile as we copy them! We are copying corrupted files... & and we don t care! Because datafile headers contain the System Change Number (SCN) which time-stamped the BEGIN BACKUP command recovery would start from the BEGIN BACKUP point-in-time if instance fails before END BACKUP command after END BACKUP, recovery would start from last checkpoint point-in-time, just like normal The backup of the datafile is simply a baseline against which redo logs are applied during recovery roll-forward.R[Br? @/'  ,4 Hot backups: the old way$$A fractured block is a database block where an earlier copy was made of the beginning of the block and a later copy was made of the end of the block Redo log change vectors can not mend this condition Oracle has no control over the I/O blocksize used by copy utilities RDBMS has to assume the worst (i.e. the backup s I/O blocksize does not match DB_BLOCK_SIZE) To deal with this situation, full block-images, not the normal change vectors data structures, are logged to the redo logs for the first change to a block after the tablespace is put into BACKUP mode. Subsequent changes are normal change vectors Full block-images protect against fractured blocksBZxZ]ZZ-Z3Z ? 5 6  )-  , L G -4 Hot backups: the old way$pThus, the volume of redo increases dramatically while a heavily-updated tablespace is in BACKUP mode possibly overwhelming the LGWR bottlenecking online RDBMS performance possibly overwhelming the ARCH process(es) and the file systems storing archived redo logs Without RMAN, solutions are hideously expensive example: double-mirrored RAID1 (i.e. three copies of data) put tablespace into BACKUP mode, then logical volume manager splits off one copy, then take tablespace out of BACKUP mode (all 3 steps take only seconds) backup then performed against split-off copy split-off copy must be resilvered back into live copies fZZ'Z[Z0Z;ZZeZ# 7'H    3  D ,{ .& Hot backups: RMANpRMAN uses a consistent-read mechanism, almost exactly like regular server processes if the database block is current in the Buffer Cache, then that image is used eliminates the possibility of fractured blocks So RMAN doesn t put tablespaces into BACKUP mode Extra redo information is not generated during a  hot backup from RMAN excessive I/O due to additional redo volume can be a serious problem for databases with high transaction ratesTN/yo 8( y  o/Incremental backups)Instead of performing a complete file copy of the datafiles, why not just copy database blocks that have been changed since the last backup? For many applications, the number of database blocks that have been changed since the last backup is small data warehouses are a good example Other backup utilities cannot read the contents of database blocks those that can (i.e. SQL*Backtrack) are explicitly not supported by Oracle Support! During incremental backups, Oracle stores the SCN of the last backup and only copies database blocks changed since thenZkZ#ZCZTZEZ3Z! be#C  T  E30Incremental backupsDepending on the type of application, incremental backups can decrease the volume of backups dramatically reduces cost of backup media reduces I/O bandwidth required to backup media important if backup media is located on network reduces time of backups`jL0&1L09Incremental backupsConsidering tradeoffs in optimizing backups or optimizing restores If your goal is to minimize volume of backups Sat: level 0 (full) Sun: level 1 (incr since level 0 on Sat) Mon: level 2 (incr since level 1 on Sun) Tues: level 3 (incr since level 2 on Mon) Wed: level 1 (incr since level 0 on Sat) Thurs: level 2 (incr since level 1 on Wed) Fri: level 3 (incr since level 2 on Thurs)C.$.&&&&&)t%%$&%:Incremental backups.Considering tradeoffs in optimizing backups or optimizing restores If your goal is to minimize time of restore Sat: level 0 (full) Sun: level 1 (incr since level 0 on Sat) Mon: level 1 (incr since level 0 on Sat) Tues: level 1 (incr since level 0 on Sat) Wed: level 1 (incr since level 0 on Sat) Thurs: level 1 (incr since level 0 on Sat) Fri: level 1 (incr since level 0 on Sat) It s good to have choices!C,$,&&&&&'  t%&%'%11Corrupt-block detectionLike the bumper sticker says: Corruption Happens! The best solution for fixing database corruption is: if the problem is a hardware or software bug, fix it! restore the affected datafile(s) from backup taken prior to occurrence of corruption recover by rolling forward with redo logs There are other possible solutions Oracle Support has utilities for block editing, etc Oracle8i has the new DBMS_REPAIR package5#] 5#!    /  2Corrupt-block detectionHIt is crucial to detect corrupted blocks before they are backed up otherwise, it will be impossible to fix using the restore and recover approach betting on any other solution (frequent exports, block editing by Oracle Support, etc) is a poor bet! Prior to Oracle8 and RMAN: the only way to accomplish this was some form of: EXP FULL=Y FILE=/dev/null even this wouldn t check the SYSTEM tablespace! big waste of resources (unless it discovers something!) SQL-generating-SQL scripts that SELECT COUNT(*) every table in the database is another optionCZZZ2ZZZ52e 2  3Corrupt-block detectionfBecause RMAN uses Oracle server processes to read database blocks, the normal block validations are performed upon read if process cannot interpret the block header, the block is marked as hard-corrupt or media-corrupt by writing a new header ORA-01578  ORACLE data block corrupted (file #nnn, block #nnn) to  alert.log RMAN also stores list of corrupt blocks in control file can be viewed in V$BACKUP_CORRUPTION and V$COPY_CORRUPTIONx;w   \ 9;,! 4Corrupt-block detectiondIf DB_BLOCK_CHECKSUM set to TRUE (default FALSE), RMAN will also checksum and compare detects logical corruptions inside database blocks blocks will be marked soft-corrupt or logical-corrupt also generates ORA-01578 message to  alert.log can be disabled with NOCHECKSUM command Caveat: RMAN can t detect every form of corruption! Nothing can: corruption is (by definition) unpredictable RMAN will allow corrupt blocks on the backup up to the limit specified by SET MAXCORRUPT if threshold is exceeded, backup terminates with errors default is SET MAXCORRUPT=0 V3f(5:YTV3 & (    !  Y  T  5SummaryIf any of the following are true, then RMAN is worth the trouble: backups take too long or too many tapes data loss cannot be tolerated database generates too much redo when in  hot backup mode An RMAN solution better enables VLDB enables more frequent backups (important if using NOLOGGING, for example) prevents data loss due to corruption If these are not important, then rest easier when considering another (3rd-party) backup utility or when using custom-built backup/recovery scripts~BZZ%ZoZZB%o! h7 DocumentationOracle8i Backup and Recovery Guide part II, chapters 4 through 10,  Using Recovery Manager Oracle Backup and Recovery 101 by Stephan Haisley, from Oracle Press Oracle9i Backup and Recovery Handbook by Rama Velpuri, from Oracle Press New  technical library section of MetaLink (http://metalink.oracle.com) contains lots of sample scripts on RMANT#9#9&&X= 7 )!01;Q&A /8/0P  ` ̙33` 3` 3333f` 999MMM` f` f3` 3>?" dU@$|?" xd @  dd`8 n?" dZ(@   @@``PR    @ ` ` p>> (     `Xgֳgֳ ?``  X*   `   Tl?   >   Tx? P > x  c $ HH|   v2  N=? 0` v2  N=? 0` v2  N=? 0`v2   N=?) 0`Iv2   N=?Y 0`yv2   N=? 0`v2   N=? 0`   Z =? L > data files   T?0 P > v2  N=? v2  N=? v2  N=?  v2  N=?0 P v2  N=?`  v2  N=?  v2  N=?  v2  N=?  v2  N=? @v2  N=?P@v2  N=?@v2  N=?@v2  N=?  v2  N=?P v2  N=? v2  N=? v2  N=? v2   N=?Pv2 ! N=?v2 " N=?v2 # N=?@v2 $ N=?@pv2 % N=?pv2 & N=?v2 ' N=?@v2 ( N=?@pv2 ) N=?pv2 * N=?v2 + N=? @ v2 , N=?P p v2 - N=?  v2 . N=?  v2 / N=?  v2 0 N=? 0 v2 1 N=?@ ` v2 2 N=?p  v2 3 N=?  v2 4 N=?  v2 5 N=?  v2 6 N=?0 P v2 7 N=?`  v2 8 N=?  v2 9 N=?  v2 : N=? v2 ; N=? @v2 < N=?P pv2 = N=? v2 > N=? v2 ? N=? v2 @ N=?0v2 A N=?@`v2 B N=?p C Z=?p `  J data files$  D Zl=?l Honline redo logfiles E Z=?P` A control files2 F T?  O Oracle server& 2 G N? p FRMAN&|B H TD>? P P 2 I T?  O Oracle server& 2 J Nج?0Pp JBackup Manager (OEM)B K ZD>? ` B L ZD>?@@p 2 M T?p `  O Oracle server& 2 N T$?p `  O Oracle server& B O ZD>? `  P ZԹ=? ATarget database Q N4=?i P QRecovery Catalog (replicated)v2 R N=?\gv2 S N=?\g|B T TD>?B U ZDf)?`  ` B V ZDf)?@  @ B W  `Df)?@  B X  `Df)? B Y  `Df)?  Z Z8=?0@ @ Backup media 2 [ T@? @ `   9MMVB \  `Df)?0 P@2 ] T? 0  9MMV|B ^ TD)? p @ |B _ TD)? @ 0  ` N=?`\ h4 true recovery catalog inH  0޽h ? ((/  ..Sal h.(  l  l T$?0 ` >  l T?   > x l c $L HH|    l T?0 P > v2 l N=? v2 l N=? v2 l N=?  v2 l N=?0 P v2 l N=?`  v2 l N=?  v2 l N=?  v2 l N=?  v2 l N=? @v2 l N=?P@v2 l N=?@v2 l N=?@v2 l N=?  v2 l N=?P v2 l N=? v2 l N=? v2 l N=? v2  l N=?Pv2 !l N=?v2 "l N=?v2 #l N=?@v2 $l N=?@pv2 %l N=?pv2 &l N=?v2 'l N=?@v2 (l N=?@pv2 )l N=?pv2 *l N=?v2 +l N=? @ v2 ,l N=?P p v2 -l N=?  v2 .l N=?  v2 /l N=?  v2 0l N=? 0 v2 1l N=?@ ` v2 2l N=?p  v2 3l N=?  v2 4l N=?  v2 5l N=?  v2 6l N=?0 P v2 7l N=?`  v2 8l N=?  v2 9l N=?  v2 :l N=? v2 ;l N=? @v2 l N=? v2 ?l N=? v2 @l N=?0v2 Al N=?@`v2 Bl N=?p Cl Zl=?p `  J data files$  Dl Z,=?l Honline redo logfiles El Z=?P` A control files2 Fl T?  O Oracle server& 2 Gl NL? p FRMAN&|B Hl TD>? P P 2 Il Th?  O Oracle server& 2 Jl ND ?0Pp JBackup Manager (OEM)B Kl ZD>? `  Pl Z#=? ATarget databasev2 Rl N=?\gv2 Sl N=?\g|B Tl TD>?B Ul ZDf)?`  ` B Vl ZDf)?@  @ B Wl  `Df)?@  B Xl  `Df)? B Yl  `Df)?  Zl Zx(=?0@ @ Backup media 2 [l T,? @ `   9MMVB \l  `Df)?0 P@2 ]l TD0? 0  9MMV|B ^l TD)? p @ |B _l TD)? @ 0  `l N<4=?`\ h4 true recovery catalog in al N8=?iP ZNocatalog mode H l 0޽h ? (   0(   x  c $> HH|   x  c $?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Root EntrydO)Current UserSummaryInformation(PowerPoint Document(WDocumentSummaryInformation8