Professional Documents
Culture Documents
Rate of data chan'e) transaction rate Database availability) *an you shutdo#n for cold backups+ *riticality of the data) ,alue of the data to the company Read-only tablespace needs backin' up just once ri'ht after you make it read-only f you are runnin' in archivelo' mode you can backup parts of a database over an e.tended cycle of days f archive lo''in' is enabled one needs to backup archived lo' files timeously to prevent database free/es 0tc.
*arefully plan backup retention periods. 0nsure enou'h backup media 1tapes) are available and that old backups are e.pired in-time to make media available for ne# backups. 2ff-site vaultin' is also hi'hly recommended. 3requently test your ability to recover and document all possible scenarios. Remember" it!s the little thin's that #ill 'et you. 4ost failed recoveries are a result of or'ani/ational errors and miscommunication.
Export Import - 0.ports are 6lo'ical6 database backups in that they e.tract lo'ical definitions and data from the database to a file. 7ee the mport) 0.port 3A8 for more details. !old or Off-line Backups - shut the database do#n and backup up A99 data" lo'" and control files.
"ot or On-line Backups - f the database is available and in AR*$ ,092G mode" set the tablespaces into backup mode and backup their files. Also remember to backup the control files and archived redo lo' files. #$%& Backups - #hile the database is off-line or on-line" use the 6rman6 utility to backup the database. Brtools Backups - Backup can be taken offline and online usin' 7A: Brtools
t is advisable to use more than one of these methods to backup your database. 3or e.ample" if you choose to do on-line database backups" also cover yourself by doin' database e.ports. Also test A99 backup and recovery scenarios carefully. t is better to be safe than sorry. Re'ardless of your strate'y" also remember to backup all required soft#are libraries" parameter files" pass#ord files" etc. f your database is in AR*$ ,092G mode" you also need to backup archived lo' files.
Alternatively" add the above commands into your database!s startup command script" and bounce the database.
5he follo#in' parameters needs to be set for databases in AR*$ ,092G mode(
-o</a)c=,8e/sta)t > TRUE -o</a)c=,8e/0est/# > 'LOCATION>?a)c=/0,)/na.e' -o</a)c=,8e/0est/state/# > ENABLE -o</a)c=,8e/@o).at > A0/At/AsBa)c
&O+E ,- Remember to take a baseline database backup ri'ht after enablin' archivelo' mode. Cithout it one #ould not be able to recover. Also" implement an archivelo' backup to prevent the archive lo' directory from fillin'-up. NOTE 2:' AR*$ ,092G mode #as introduced #ith 2racle >" and is essential for database point-in-time recovery. Archivin' can be used in combination #ith on-line and off-line database backups. &O+E .- ;ou may #ant to set the follo#in' & 5.2RA parameters #hen enablin' AR*$ ,092G mode( log_archive_start=TRUE" log_archive_dest=..." and log_archive_format=... &O+E /- ;ou can chan'e the archive lo' destination of a database on-line #ith the ARCH !E "O# $TART TO 'director%'& statement. 5his statement is often used to s#itch archivin' bet#een a set of directories. &O+E 0- Chen runnin' 2racle Real Application *lusters 1RA*)" you need to shut do#n all nodes before chan'in' the database to AR*$ ,092G mode. 7ee the RA* 3A8 for more details.
I1ve lost an archived online #E2O )O* file3 can I get my 2B back?
5he follo#in' & 5.2RA)7:3 90 parameter can be used if your current redolo's are corrupted or blo#n a#ay. t may also be handy if you do database recovery and one of the archived lo' files are missin' and cannot be restored. &250( !aution is advised #hen enablin' this parameter as you mi'ht end-up losing your entire database. :lease contact 2racle 7upport before usin' it.
/a--oC/)eset-o<s/co))*3t,on > t)*e
5his should allo# you to open the database. $o#ever" after usin' this parameter your database #ill be inconsistent 1some committed transactions may be lost or partially applied). 4teps
Do a 67$<5D2C& &2R4A96 of the database 7et the above parameter Do a 675AR5<: 42<&56 and 6A950R DA5ABA70 2:0& R070592G7D6
f the database asks for recovery" use an <&5 9 *A&*09 type recovery and apply all available archive and on-line redo lo's" then issue *A&*09 and reissue the 6A950R DA5ABA70 2:0& R070592G7D6 command. Cait a couple of minutes for 2racle to sort itself out Do a 67$<5D2C& &2R4A96 Remove the above parameter% Do a database 675AR5<:6 and check your A90R5.92G file for errors. 0.tract the data and rebuild the entire database
7ometimes 2racle takes forever to shutdo#n #ith the 6immediate6 option. As #orkaround to this problem" shutdo#n usin' these commands(
a-te) s:ste. c=ecE3o,nt( s=*t0oCn a7o)t sta)t*3 )est),ct s=*t0oCn ,..e0,ate
&ote that if your database is in AR*$ ,092G mode" one can still use archived lo' files to roll for#ard from an off-line backup. f you cannot take your database do#n for a cold 1off-line) backup at a convenient time" s#itch your database into AR*$ ,092G mode and perform hot 1on-line) backups.
t is better to backup tablespace for tablespace than to put all tablespaces in backup mode. Backin' them up separately incurs less overhead. Chen done" remember to backup your control files. 9ook at this e.ample(
ALTER SYSTEM SIITC5 LO$'ILE( -- 'o)ce -o< sC,tc= to *30ate cont)o- @,-e =ea0e)s ALTER DATABASE BAC%U& CONTROL'ILE TO '?7acE*3D,)?cont)o-B07@'(
&250( Do not run on-line backups durin' peak processin' periods. 2racle #ill #rite complete database blocks instead of the normal deltas to redo lo' files #hile in backup mode. 5his #ill lead to e.cessive database archivin' and even database free/es.
2ne can select from ,GBA*E<: to see #hich datafiles are in backup mode. 5his normally saves a si'nificant amount of database do#n time. 7ee script endHbackupA.sql in the 7cripts section of this site. 3rom 2racleIi on#ards" the follo#in' command can be used to take all of the datafiles out of hotbackup mode(
ALTER DATABASE END BAC%U&(
5his command must be issued #hen the database is mounted" but not yet opened.
$ere is an e.ample(
Ko)ac-eL-oca-=ost o)ac-eMD ).an Reco8e): Mana<e)" Re-ease #0B#B0B2B0 &)o0*ct,on Co3:),<=t 1c6 #99N4 20024 O)ac-eB A-- ),<=ts )ese)8e0B RMAN> connect ta)<et( connecte0 to ta)<et 0ata7ase" ORCL 1DBID>#0NO9NP0206 RMAN> 7acE*3 0ata7ase( BBB
).an ta)<et s:s?QQQ nocata-o< )*n + a--ocate c=anne- t# t:3e 0,sE( 7acE*3 @o).at '?a33?o)ac-e?7acE*3?A0/tAt/sAs/3A3' 10ata7ase6( )e-ease c=anne- t#( 9
5he e.amples above are e.tremely simplistic and only useful for illustratin' basic concepts. By default 2racle uses the database controlfiles to store information about backups. &ormally one #ould rather setup a R4A& catalo' database to store R4A& metadata in. Read the 2racle Backup and Recovery Guide before implementin' any R4A& backups. &ote( R4A& cannot #rite ima'e copies directly to tape. 2ne needs to use a third-party media mana'er that inte'rates #ith R4A& to backup directly to tape. Alternatively one can backup to disk and then manually copy the backups to tape.
5he 6delete input6 clause #ill delete the archived lo's as they as backed-up. 9ist all archivelo' backups for the past AB hours(
RMAN> LIST BAC%U& O' ARC5IVELO$ 'ROM TIME 's:s0ate-#'(
J*ota *n-,.,te0 on too-s( SQL> <)ant connect4 )eso*)ce4 )eco8e):/cata-o</oCne) to ).an( SQL> eF,t(
&e.t" lo' in to rman and create the catalo' schema. :rior to 2racle Ki this #as done by runnin' the catrma(.s)l script.
).an cata-o< ).an?).an RMAN> c)eate cata-o< ta7-es3ace too-s( RMAN> eF,t(
;ou can no# continue by re'isterin' your databases in the catalo'. 9ook at this e.ample(
).an cata-o< ).an?).an ta)<et 7acE07a?7acE07a RMAN> )e<,ste) 0ata7ase(
2ne can also use the 6up'rade catalo'D6 command to up'rade to a ne# R4A& release" or the 6drop catalo'D6 command to remove an R4A& catalo'. 5hese commands need to be entered t#ice to confirm the operation.
,eritas &etBackup - http())###.veritas.com) 04* Data 4ana'er 10D4) - http())###.emc.com) $: 24& Back) Data:rotector - http())###.hp.com) B4!s 5ivoli 7tora'e 4ana'er 1formerly AD74) - http())###.tivoli.com)stora'e) 04* &et#orker - http())###.emc.com) Bri'ht7tor AR*serve Backup - http())###.ca.com)us)data-loss-prevention.asp. 7terlin' 7oft#are!s 7A47(Ale.andria 1formerly from 7pectralo'ic) http())###.sterlin'.com)sams) 7<&!s 7olstice Backup - http())###.sun.com)soft#are)#hitepapers)backup-n-stora'e) *omm,ault Gala.y - http())###.commvault.com) etc...
5he above 4edia 4ana'ement ,endors #ill provide first line technical support 1and installation 'uides) for their respective products. A complete list of supported 4edia 4ana'ement ,endors can be found at( http())###.oracle.com)technolo'y)deploy)availability)htdocs)bsp.htm Chen allocatin' channels one can specify 4edia 4ana'ement spesific parameters. $ere are some e.amples(
or(
a--ocate c=anne- '0e8/#' t:3e 's7t/ta3e' 3a).s 'ENV>OB2BARTY&E>O)ac-eO4OB2A&&NAME>o)c-4OB2BARLIST>.ac=,nena.e/o)c-/a)c=-o<s6 '(
5he above script #ill connect to the 6tar'et6 1database that #ill be cloned)" the recovery catalo' 1to 'et backup info)" and the au.iliary database 1ne# duplicate DB). :revious backups #ill be restored and the database recovered to the 6set until time6 specified in the script. &otes( the 6set ne#name6 commands are only required if your datafile names #ill different from the tar'et database.
!an one restore #$%& backups without a !O&+#O);I)E and #E!O(E#< !%+%)O*?
Details of R4A& backups are stored in the database control files and optionally a Recovery *atalo'. f both these are 'one" R4A& cannot restore the database. n such a situation one must e.tract a control file 1or other files) from the backup pieces #ritten out #hen the last backup #as taken. 9et!s look at an e.ample( 9et!s take a backup 1partial in our case for ilustrative purposes)(
D ).an ta)<et ? nocata-o< Reco8e): Mana<e)" Re-ease #0B#B0B2B0 - !27,t &)o0*ct,on Co3:),<=t 1c6 #99N4 20024 O)ac-eB A-- ),<=ts )ese)8e0B connecte0 to ta)<et 0ata7ase" ORCL 1DBID>#02!!!2!296 *s,n< ta)<et 0ata7ase cont)o-@,-e ,nstea0 o@ )eco8e): cata-o< RMAN> 7acE*3 0ata@,-e #( Sta)t,n< 7acE*3 at 20AU$-02 a--ocate0 c=anne-" ORA/DIS%/# c=anne- ORA/DIS%/#" s,0>#2! 0e8t:3e>DIS% c=anne- ORA/DIS%/#" sta)t,n< @*-- 0ata@,-e 7acE*3set c=anne- ORA/DIS%/#" s3ec,@:,n< 0ata@,-e1s6 ,n 7acE*3set ,n3*t 0ata@,-e @no>0000# na.e>?o)a0ata?o)c-?s:ste.0#B07@ c=anne- ORA/DIS%/#" sta)t,n< 3,ece # at 20AU$-02 c=anne- ORA/DIS%/#" @,n,s=e0 3,ece # at 20-AU$-02 3,ece =an0-e> ?@-as=/)eco8e):/a)ea?ORCL?7acE*3set?2002/0O/20?o#/.@/nnn0@/TA$20020O20T#N 2N! /0-cG09t@/B7E3 co..ent>NONE c=anne- ORA/DIS%/#" 7acE*3 set co.3-ete4 e-a3se0 t,.e" 00"00"2N c=anne- ORA/DIS%/#" sta)t,n< @*-- 0ata@,-e 7acE*3set c=anneORA/DIS%/#" s3ec,@:,n< 0ata@,-e1s6 ,n 7acE*3set ,nc-*0,n< c*))ent cont)o-@,-e ,n 7acE*3set ,nc-*0,n< c*))ent S&'ILE ,n 7acE*3set c=anne- ORA/DIS%/#" sta)t,n< 3,ece # at 20-AU$-02 c=anne- ORA/DIS%/#" @,n,s=e0 3,ece # at 20-AU$02 3,ece =an0-e> ?@-as=/)eco8e):/a)ea?ORCL?7acE*3set?2002/0O/20?o#/.@/ncsn@/TA$20020O20T#N 2N! /0-cG@)FO/B7E3 co..ent>NONE c=anne- ORA/DIS%/#" 7acE*3 set co.3-ete4 e-a3se0 t,.e" 00"00"02 ',n,s=e0 7acE*3 at 20-AU$-02K?co0eM
&o#" let!s see if #e can restore it. 3irst #e need to start the databaase in &242<&5 mode(
SQL> sta)t*3 NOMOUNT ORACLE ,nstance sta)te0B Tota- S:ste. $-o7a- A)ea 2O920!9P! 7:tes ',Fe0 S,Ge # 0#N ! 7:tes Va),a7-e S,Ge 2!2!PP2P2 7:tes Data7ase B*@@e)s 2N#!NO22 7:tes Re0o B*@@e)s 2!2#22 7:tesU?3)e>
&o#" from 789=:lus" run the follo#in' :9)789 block to restore the file(
DECLARE 8/0e8t:3e VARC5AR21#006( 8/0one BOOLEAN( 8/.aF&,eces NUMBER( TY&E t/3,eceNa.e IS TABLE O' 8a)c=a)212NN6 INDE; BY 7,na):/,nte<e)( 8/3,eceNa.e t/3,eceNa.e( BE$IN -- De@,ne t=e 7acE*3 3,ecesBBB 1na.es @)o. t=e RMAN Lo< @,-e6 8/3,eceNa.e1#6 "> '?@-as=/)eco8e):/a)ea?ORCL?7acE*3set?2002/0O/20?o#/.@/ncsn@/TA$20020O20T#N 2N !/0-cG@)FO/B7E3'( 8/3,eceNa.e126 "> '?@-as=/)eco8e):/a)ea?ORCL?7acE*3set?2002/0O/20?o#/.@/nnn0@/TA$20020O20T#N 2N !/0-cG09t@/B7E3'( 8/.aF&,eces "> 2( -- A--ocate a c=anne-BBB 1Use t:3e>>n*-- @o) DIS%4 t:3e>>'s7t/ta3e' @o) TA&E6 8/0e8t:3e "> DBMS/BAC%U&/RESTOREB0e8,ceA--ocate1t:3e>>NULL4 ,0ent>>'0#'6( -- Resto)e t=e @,)st Cont)o- ',-eBBB DBMS/BAC%U&/RESTOREB)esto)eSetData',-e( -C'NAME .,st 7e t=e eFact 3at= an0 @,-ena.e o@ a cont)o-@,-e ta=t Cas 7acEe0*3 DBMS/BAC%U&/RESTOREB)esto)eCont)o-',-eTo1c@na.e>>'?a33?o)ac-e?o)a0ata?o)c-?co nt)o-0#Bct-'6( 07.s/o*t3*tB3*t/-,ne1'Sta)t )esto),n< 'VV8/.aF&,ecesVV' 3,ecesB'6( 'OR , IN #BB8/.aF&,eces LOO& 07.s/o*t3*tB3*t/-,ne1'Resto),n< @)o. 3,ece 'VV8/3,eceNa.e1,66( DBMS/BAC%U&/RESTOREB)esto)eBacE*3&,ece1=an0-e>>8/3,eceNa.e1,64 0one>>8/0one4 3a)a.s>>n*--6( eF,t C=en 8/0one( END LOO&( -- Dea--ocate t=e c=anne-BBB DBMS/BAC%U&/RESTOREB0e8,ceDeA--ocate1'0#'6( E;CE&TION I5EN OT5ERS T5EN DBMS/BAC%U&/RESTOREB0e8,ceDeA--ocate( RAISE( END( ?