RMAN Backups Concepts.docx
《RMAN Backups Concepts.docx》由会员分享,可在线阅读,更多相关《RMAN Backups Concepts.docx(49页珍藏版)》请在冰豆网上搜索。
RMANBackupsConcepts
RMANBackupsConcepts
ThischapterdescribesthebasicconceptsinvolvedinbackingupthedatabasewiththeRecoveryManager(RMAN)utility.
Thischaptercontainsthesetopics:
∙AboutRMANChannels
∙AboutRMANBackups
∙MultipleCopiesofRMANBackups
∙RMANBackupOptions:
Naming,Sizing,andSpeed
∙RMANBackupTypes
∙ControlFileandServerParameterFileAutobackups
∙BackupRetentionPolicies
∙BackupOptimization
∙RestartableBackups
∙ManagingBackupWindowsandPerformance:
BACKUP...DURATION
∙RMANBackupErrors
∙TestsandIntegrityChecksforBackups
AboutRMANChannels
AnRMANchannelrepresentsonestreamofdatatoadevicetype,andcorrespondstooneserversession.MostbackupandrecoverycommandsinRMANareexecutedbyserversessions.AsillustratedinFigure 2-1,eachchannelestablishesaconnectionfromtheRMANclienttoatargetorauxiliarydatabaseinstancebystartingaserversessionontheinstance.Theserversessionperformsthebackup,restore,andrecovery.
Figure2-1ChannelAllocation
Textdescriptionoftheillustrationbradv030.gif
YoucanusetheCONFIGURECHANNELcommandtoconfigurechannelsforusewithdiskortapeinallRMANsessionsusingautomaticchannelallocation,orallocatechannelsmanuallywithinaRUNblock.RMANcomespreconfiguredwithoneDISKchannelthatyoucanuseforbackupstodisk.
Whenyourunacommandthatrequiresachannelwithoutallocatingachannelexplicitly,thenRMANautomaticallyallocatesthechannelswiththeoptionsspecifiedintheCONFIGUREcommand.FortheBACKUPcommand,RMANallocatesonlyasingletypeofchannel,suchasDISK.FortheRESTOREcommandandmaintenancecommands(forexample,DELETE),RMANallocatesallnecessarychannelsforthedevicetypesrequiredtoexecutethecommand.
Tospecifythedevicetypetouseforanoperationexplicitly,usetheALLOCATECHANNELcommand,whichmustbeusedwithinaRUNblock,orALLOCATECHANNELFORMANTAINANCE,whichmustbeexecutedattheRMANprompt.
InaRealApplicationClustersconfiguration,therearespecialconsiderationsregardingchannelallocationandbackups.SeeOracleRealApplicationClustersAdministrator'sGuideformoredetails.
HowandwhentheALLOCATECHANNELorCONFIGURECHANNELcommandscausethemediamanagertoallocateresourcesisvendor-specific.Somemediamanagersallocateresourceswhenyouissuethecommand;othersdonotallocateresourcesuntilyouopenafileforreadingorwriting.
SeeAlso:
OracleDatabaseRecoveryManagerReferenceforALLOCATECHANNELsyntaxandOracleDatabaseRecoveryManagerReferenceonALLOCATECHANNELFORMAINTENANCE
AutomaticandManualChannelAllocation
Youcanusetheautomaticchannelallocationfeaturetoconfigureasetofpersistent,automaticchannelsforuseinallRMANsessions.YoucanusethemanualchannelallocationfeaturetospecifychannelsforcommandsusedwithinaRUNblock.
RMANallocatesautomaticchannelsaccordingtothesettingsinthesecommands:
∙CONFIGUREDEVICETYPE...PARALLELISM
∙CONFIGUREDEFAULTDEVICETYPE
∙CONFIGURECHANNEL
Forexample,youcanissuethefollowingcommandsattheRMANprompt:
#sinceyoudonotmanuallyallocatechannels,RMANusespreconfiguredchannels
BACKUPDATAFILE3;
RESTORETABLESPACEusers;
Whenyourunacommandthatrequireschannels,andnochannelshavebeenallocatedusingtheALLOCATEcommand,RMANautomaticallyallocateschannelsaccordingtovaluessetwiththeCONFIGUREcommandinthefollowingcases:
∙YouusecommandssuchasBACKUP,RESTORE,orDELETEoutsideofaRUNblock.
∙YouusecommandswithinaRUNblockbutdonotallocateanychannelswithintheRUNblock.
YoucanoverrideautomaticchannelallocationsettingsbymanuallyallocatingchannelswithinaRUNblock.Manualchannelsalwaysoverrideautomaticchannels.Forexample,youoverrideautomaticchannelallocationwhenyouissueacommandasfollows:
RUN
{
ALLOCATECHANNELc1DEVICETYPEsbt;
BACKUPDATABASEPLUSARCHIVELOG;
}
RMANoptimizesautomaticchannelallocationbyleavingautomaticchannelsallocatedsolongaseachnewcommandrequiresexactlythesamechannelconfigurationasthepreviouscommand.Forexample,RMANcanusethesamepreallocatedchannelsforthefollowingseriesofcommands:
BACKUPDATAFILE1;
BACKUPCURRENTCONTROLFILE;
BACKUPARCHIVELOGALL;
IfyouissueacommandsuchasALLOCATEorCONFIGURE,thenRMANautomaticallyreleasesthepreallocatedchannels.
SeeAlso:
"ConfiguringAutomaticChannels"tolearnhowtoconfigureautomaticchannels
AutomaticChannelDeviceConfigurationandParallelism
TheCONFIGUREDEVICETYPE...PARALLELISMcommandspecifiesthenumberofautomaticchannelstoallocateforaspecifieddevicetype.Forexample,ifyouconfigureparallelismto3foradevicetype,thenRMANallocatesthreechannelsforthedevicetypewhenusingautomaticchannels.
YoucanchangeaparallelismsettingbyissuinganotherCONFIGUREDEVICETYPE...PARALLELISMcommand.ThisexampleconfiguresPARALLELISM2andthenchangesitto3:
CONFIGUREDEVICETYPEDISKPARALLELISM2;
CONFIGUREDEVICETYPEDISKPARALLELISM3;
TheparallelismsettingdefinesthenumberofchannelsforadevicethatRMANallocatesinparallel.Itdoesnothavetocorrespondtotheactualnumberofchannelsconfiguredforthedevice.Forexample,youcanmanuallyconfigurefourdifferentsbtchannelsandsetPARALLELISMforsbtto2,1,or10.
YoucanviewthedefaultsettingforparallelismbyrunningtheSHOWDEVICETYPEcommand.Forexample:
RMAN>SHOWDEVICETYPE;
RMANconfigurationparametersare:
CONFIGUREDEVICETYPEDISKPARALLELISM1BACKUPTYPETOBACKUPSET;#default
AsalwayswhentheSHOWcommandisusedtoviewthevalueofaparameter,RMANincludesa"#default"commentattheendofthelineiftheRMANdefaultvaluehasnotbeenoverridden.
ThefollowingexampleconfiguresthedefaultdevicetosbtandthendisplaystheresultingconfigurationusingtheSHOWDEVICETYPEcommand:
RMAN>CONFIGUREDEFAULTDEVICETYPETOsbt;
newRMANconfigurationparameters:
CONFIGUREDEFAULTDEVICETYPETO'sbt';
newRMANconfigurationparametersaresuccessfullystored
RMAN>SHOWDEVICETYPE;
RMANconfigurationparametersare:
CONFIGUREDEVICETYPESBTPARALLELISM1;#default
CONFIGUREDEVICETYPEDISKPARALLELISM1BACKUPTYPETOBACKUPSET;#
default
SeeAlso:
"ConfiguringaGenericAutomaticChannelforaDeviceType"
AutomaticChannelDefaultDeviceTypes
RuntheCONFIGUREDEFAULTDEVICETYPEcommandtospecifyadefaultdevicetypeforautomaticchannels.Forexample,youmaymakebackupstotapemostofthetimeandonlyoccasionallymakeabackuptodisk.Inthiscase,configurechannelsfordiskandtapedevices,butmakesbtthedefaultdevicetype:
CONFIGUREDEVICETYPEDISKPARALLELISM1;#configuredevicedisk
CONFIGUREDEVICETYPEsbtPARALLELISM2;#configuredevicesbt
CONFIGUREDEFAULTDEVICETYPETOsbt;
Now,RMANwill,bydefault,usesbtchannelsforbackups.Forexample,ifyourunthefollowingcommand:
BACKUPTABLESPACEusers;
RMANonlyallocateschannelsoftypesbtduringthebackupbecausesbtisthedefaultdevice.
Youcanoverridethedefaultdeviceforbackupsbyspecifyingadifferentdeviceonthecommand.Forexample:
BACKUPDEVICETYPEsbtDATABASE;
IfthedefaultdevicetypeisDISK,thentheprecedingcommandoverridesthisdefaultandusesthesbtchannelconfiguration.Notethatthiscommandfailsunlessyouhaveconfiguredthesbtdeviceorconfiguredsbtchannels.
Whenrestoringfiles,RMANallocatesallautomaticchannelsaccordingtothesettingsconfiguredforeachdevicetype.Thedefaultdevicetypeconfigurationisirrelevant.Forexample,ifyouconfigurePARALLELISMto3forthedefaultsbtdeviceandPARALLELISMto2forDISK,thenRMANautomaticallyallocatesthreesbtchannelsandtwoDISKchannelsduringtherestore.
AutomaticChannelNamingConventions
RMANusesthefollowingconventionforchannelnaming:
ORA_devicetype_n,wheredevicetypereferstotheuser'sdevicetype(suchasDISKorsbt_tape)andnreferstothechannelnumber.
Note:
Thesbtandsbt_tapedevicetypesaresynonymous,butRMANoutputalwaysdisplayssbt_tapewhethertheinputissbtorsbt_tape.
Forexample,RMANnamesthefirstDISKchannelORA_DISK_1,thesecondORA_DISK_2,andsoforth.RMANnamesthefirstsbtchannelORA_SBT_TAPE_1,thesecondORA_SBT_TAPE_2,andsoforth.Whenyouparallelizechannels,RMANalwaysallocateschannelsinnumericalorder,startingwith1andendingwiththeparallelismsetting(CONFIGUREDEVICETYPE...PARALLELISMn),asinthisexample:
ORA_SBT_TAPE_1
ORA_SBT_TAPE_2
ORA_SBT_TAPE_3
Automaticchannelallocationalsoappliestomaintenancecommands.IfRMANallocatesanautomaticmaintenancechannel,thenitusesthesamenamingconventionasanyotherautomaticallyallocatedchannel.IfyoumanuallyallocateamaintenancechannelusingALLOCATECHANNELFORMAINTENANCE,thenRMANusesthefollowingconventionforchannelnaming:
ORA_MAINT_devicetype_n,wheredevicetypereferstotheuser'sdevicetype(forexample,DISKorsbt)andnreferstothechannelnumber.Forexample,RMANusesthesenamesfortwomanuallyallocateddiskchannels:
ORA_MAINT_DISK_1
ORA_MAINT_DISK_2
NotethatifyouruntheCONFIGUREDEVICETYPEcommandtoconfigureadevicetypeanddonotrunCONFIGURECHANNELforthisdevicetype,thenRMANallocatesallchannelswithoutotherchannelcontroloptions.Forexample,assumethatyouconfigurethesbtdeviceandrunabackupasfollows:
CONFIGUREDEVICETYPEsbtPARALLELISM1;
BACKUPDEVICETYPEsbtDATABASE;
Ineffect,RMANdoesthefollowing:
RUN
{
ALLOCATECHANNELORA_SBT_TAPE_1DEVICETYPEsbt;
BACKUPDATABASE;
}
Channelnam