Backup and Recovery Strategies.docx
《Backup and Recovery Strategies.docx》由会员分享,可在线阅读,更多相关《Backup and Recovery Strategies.docx(19页珍藏版)》请在冰豆网上搜索。
BackupandRecoveryStrategies
2
BackupandRecoveryStrategies
Thischapteroffersguidelinesandconsiderationsfordevelopinganeffectivebackupandrecoverystrategy.
Thissectionincludesthefollowingtopics:
∙DataRecoveryStrategyDeterminesBackupStrategy
∙PlanningDataRecoveryStrategy
∙PlanningBackupStrategy
∙ValidatingYourDataRecoveryStrategy
DataRecoveryStrategyDeterminesBackupStrategy
Todecideonbackupstrategies,startwithyourdatarecoveryrequirementsandyourdatarecoverystrategy.Eachtypeofdatarecoverywillrequirethatyoutakecertaintypesofbackup.
Failurescanrunthegamutfromusererror,datafileblockcorruptionandmediafailuretosituationslikethecompletelossofadatacenter.Howquicklyyoucanresumenormaloperationofyourdatabaseisafunctionofwhatkindsofrestoreandrecoverytechniquesyouincludeinyourplanning.Eachrestoreandrecoverytechniquewillimposerequirementsonyourbackupstrategy,includingwhichfeaturesoftheOracledatabaseyouusetotake,storeandmanageyourbackups.
Whenthinkingaboutrecoverystrategies,askyourselfquestionslikethese:
∙Ifadiskfailedanddestroyedsomeofthedatabasefiles,suchasdatafilesorredologs,howwouldyourecoverthelostfiles?
Asdescribedin"PlanningaResponsetoMediaFailure:
RestoreandMediaRecovery",youshouldbeabletohandlethelossofdatafiles,controlfiles,andonlineredologs.
∙Ifalogicerrorinanapplicationorausererrorcausedthelossofimportantdatafromoneorseveraltablesortablespaces,howcouldyourecoverthatdata,andwhatwouldhappentodatabaseupdatessincetheerror?
Couldyoudeterminethecauseoftheerror,topreventitfromhappeningagain?
Asdescribedin"PlanningaResponsetoUserError:
Point-in-TimeRecoveryandFlashbackFeatures",techniquesavailabletoyouincludepoint-in-timerecoveryofthewholedatabaseoroneormoretablespaces,importingdatafromearlierlogicalexportswithoneofthedataimportutilities,andusingtheOracledatabase'sflashbackfeatures.
∙Iftheinstancealertlogindicatesthatoneormoretablescontainscorruptblocks,howcanyourepairthecorruption?
Doesthetablespacehavetoremainavailableduringtherepair?
Asdescribedin"PlanningaResponsetoDatafileBlockCorruption:
BlockMediaRecovery",theRMANBLOCKRECOVERcommandcanhelpyouinthissituation.Also,troubleshootrecoverywiththeSQL*PlusRECOVER...TESTcommand.
∙Iftheentiredatacenterisdestroyed,canyouperformdisasterrecovery?
Assumethatallyouhaveisanarchivetapecontainingbackups.Howwouldyourecoverthedatabase?
Howlongwouldthatrecoverytake?
∙Ifyouwerenotavailabletorecoveryourdatabase,couldsomeoneelserecoveritinyourabsence?
Areyourrecoveryproceduressufficientlyautomatedanddocumented?
Withtheseneedsinmind,decidehowyoucantakeadvantageoffeaturesrelatedtobackupandrecovery,andlookathoweachfeaturemeetssomerequirementofyourbackupstrategy.Forexample:
∙UsingRecoveryManagersimplifiesmostbackupandrecoveryoperationscomparedtouser-managedbackupandrecovery.Itautomatesmanagementofmostbackupfiles,includingthedeletionofbackupsandarchivedredologsfromdiskortapewhennolongerneededtomeetrecoverygoals.Itprovidesdetailedreportingonbackupactivities,canverifythatyouravailablebackupscanbeusedtorecoveryourdatabase.Finally,RMANmakespossiblemanyrecoverytechniquesnotavailableifyouareusinguser-managedbackupandrecovery,suchasincrementalbackups.
∙FlashbackDatabasewillhelpyourestoreadatabasetoaprevioustimemuchfasterthanmediarecovery.However,youmustdecideinadvancetokeepflashbacklogs,andkeepingflashbacklogsrequiresthatyouconfigureaflashrecoveryarea.
∙Blockmediarecoverymaybebetterthandatafilemediarecoveryifavailabilityiscritical.WhileblockmediarecoveryispossibleevenifyoudonotbaseyourbackupandrecoverystrategyonRMAN,RMAN-basedblockmediarecoverycanbeperformedmorequicklyandwithlesseffort.
Onceyoudecidewhichfeaturestouseinyourrecoverystrategy,youcanplanyourbackupstrategy,answeringthefollowingquestions,amongothers:
∙Howandwherewillyoustoreyourrecovery-relatedfiles?
Willyouuseaflashrecoveryarea?
WillyouuseanASMdiskgroup?
Willyoustorebackupsontapeorotherofflinestorage,oronlyondisk?
∙Atwhatintervalswillyoutakescheduledbackups?
Andwhatformofphysicalbackupswillyoutakeineachsituation?
∙Whatsituationsrequireyoutotakeadatabasebackupoutsideoftheregularschedule?
Sometimesyoumusttakeanunscheduledbackuptoensurethatyoucanrecoveryourdata,suchasafteranOPENRESETLOGSorafterchangestoyourdatabasesuchasNOLOGGINGoperationsthatdonotappearintheredolog.Youmayalsohavebusinessrequirementsthatrequirebackupsforauditingpurposesorotherreasonsnotrelatedtodatabaserecovery.
∙Howcanyouvalidateyourbackups,toensurethatyoucanrecoveryourdatabasewhennecessary?
∙Howdoyoumanagerecordsofyourbackups?
∙Doyouhavedetailedrecoveryplansthatcovereachtypeoffailure?
HowdoyourDBAscanexecutetheseplansinacrisis?
Canscriptsbewrittentoautomateexecutionoftheseplansinacrisis?
∙CanyouapplyOracledatabaseavailabilitytechnologies,suchasDataGuardorRealApplicationClusters,toimproveavailabilityduringadatabasefailure?
Howdoesusingtheseavailabilitytechnologiesaffectyourbackupandrecoverystrategy?
Theseareofcourseonlyafewoftheconsiderationsyoushouldtakeintoaccount.Availableresources(hardware,media,staff,budget,andsoon)willalsobefactorsinyourdecision.
PlanningDataRecoveryStrategy
Yourdatarecoverystrategyshouldincluderesponsestoanynumberofdatabasefailurescenarios.Thekeytoaneffective,efficientstrategyisenvisioningfailuremodes,matchingOracledatabaserecoverytechniquesandtoolstothefailuremodesinwhichtheyareuseful,andthenmakingsureyouincorporatethenecessarybackuptypestosupportthoserecoverytechniques.
Tohelpmatchfailuremodestorecoverytechniquesthatcanhelpresolvethem,refertothefollowingsections:
∙PlanningaResponsetoUserError:
Point-in-TimeRecoveryandFlashbackFeatures
∙PlanningaResponsetoMediaFailure:
RestoreandMediaRecovery
∙PlanningaResponsetoDatafileBlockCorruption:
BlockMediaRecovery
PlanningaResponsetoUserError:
Point-in-TimeRecoveryandFlashbackFeatures
Yourbackupandrecoverystrategyshouldenableyoutohandlesituationsinwhichauserorapplicationmakesunwantedchangestodatabasedata,suchasdeletingthecontentsofatableormakingincorrectupdatesduringabatchrun.Thegoalinsuchacasewillbetorestoretheaffectedpartsofyourdatabasetotheirstatebeforetheusererror.
Dependingonthesituation,yourappropriateresponsewillbeoneofthefollowing:
∙Ifyouhaveperformedalogicalbackupbyexportingthecontentsoftheaffectedtables,sometimesyoucanimportthedatabackintothetable.Thistechniquepresumesthatyouareregularlyexportinglogicalbackupsofyourdata,andthatanychangesbetweenexportsareunimportant.
∙Youcanperformpoint-in-timerecovery,bringingonetablespaceorthewholedatabasebacktoitsstatebeforethetimeoftheerror.Ineithercase,youneedbackupsfrombeforethetimeoftheerror,plustheredologsfromthetimeofthebackuptothetimeoftheerror.
Note:
Oracle'sFlashbackTechnologyprovidesfasterandlessdisruptivealternativestomediarecoveryinmanycircumstances.
∙OracleFlashbackDatabaseisaphysical-levelrecoverymechanismsimilartomediarecovery,butgenerallyfasterandnotrequiringtherestoreofdatafrombackup.
∙OracleFlashbackTableandOracleFlashbackDropworkatthelogicallevel,undoingunwantedchangestotables,includingreversingtheeffectsofDROPTABLEstatements.
∙OracleFlashbackQueryandOracleFlashbackVersionQueryareusefulinviewingpastcontentsoftablesandinvestigatinghowandwhenlogicalcorruptionsaffectedyourdatabase.
InformationaboutthesefeaturesiscollectedinOracleDatabaseBackupandRecoveryAdvancedUser'sGuide.Thisdocumentwillalludetosuchfeatureswheretheycanbehelpfulandprovidepointersformoreinformation.Familiarizeyourselfwiththesefeaturesbeforeplanningyourbackupandrecoverystrategy,becauseyoumayfindthattheycanbequitevaluableandrequirelimitedadvancedplanning.
PlanningaResponsetoMediaFailure:
RestoreandMediaRecovery
AmediafailureoccurswhenaproblemexternaltothedatabasepreventsOraclefromreadingfromorwritingtoafileduringdatabaseoperations.Typicalmediafailuresincludephysicalfailures,suchasheadcrashes,andtheoverwriting,deletionorcorruptionofadatabasefile.Mediafailuresarelesscommonthanuserorapplicationerrors,butyourbackupandrecoverystrategyshouldprepareforthem.
Thetypeofmediafailuredeterminestherecoverytechniquetouse.Forexample,thestrategyyouusetorecoverfromacorrupteddatafileisdifferentfromthestrategyforrecoveringfromthelossofthecontrolfile.
Example:
OnlineRedoLogRecovery
Themethodofrecoveryfromlossofallmembersofanonlineloggroupdependsonanumberoffactors,suchas:
∙Thestateofthedatabase(open,crashed,closedconsistently,andsoon)
∙Whetherthelostredologgroupwascurrent
∙Whetherthelostredologgroupwasarchived
Forexample:
∙Ifyoulosethecurrentgroup,andthedatabaseisnotclosedconsistently(eitheritisopen,orithascrashed),thenyouwillhavetorestore