Tuning Backup and Recovery.docx
《Tuning Backup and Recovery.docx》由会员分享,可在线阅读,更多相关《Tuning Backup and Recovery.docx(21页珍藏版)》请在冰豆网上搜索。
TuningBackupandRecovery
TuningBackupandRecovery
TuningRMANperformanceismostlyamatterofmaximizingthespeedwithwhichRMANcreatesyourbackupsandrestoresfrombackups,ondiskandespeciallyontape.Asecondaryconcernislimitingtheeffectofbackupactivitiesondatabasethroughput.
Youmayalsoneedtotuneperformanceofthedatabaseduringinstancerecovery.
Thischaptercoverstheconceptsneededforperformancetuning,andthefeaturesinRMANthatcanhelpyou.Thediscussionisdividedintothefollowingsections:
∙TuningRecoveryManager:
Overview
∙FeaturesandOptionsUsedtoTuneRMANPerformance
∙TuningRMANBackupPerformance:
Examples
∙InstanceRecoveryPerformanceTuning:
FAST_START_MTTR_TARGET
TuningRecoveryManager:
Overview
RMANbackupandrestoreoperationshavethefollowingdistinctcomponents:
∙Readingorwritinginputdata
∙Processingdatabyvalidatingblocksandcopyingthemfromtheinputtotheoutputbuffers
TheslowestoftheseoperationsinanyRMANtaskiscalledthebottleneck.RMANtuninginvolvesidentifyingthebottlenecksforagiventaskandusingRMANcommands,initializationparametersettings,oradjustmentstophysicalmediatoimproveperformanceonthebackup.
ThekeytotuningRMANisunderstandinghowitperformsI/O.RMAN'sbackupandrestorejobsusetwotypesofI/Obuffers:
DISKandtertiarystorage(usuallytape).Whenperformingabackup,RMANreadsinputfilesusingdiskbuffersandwritestheoutputbackupfilebyusingeitherdiskortapebuffers.Restoreoperationsusediskortapebuffersforinput,dependingonwherethebackupisstored,anddiskbuffersforoutput.
TotuneRMANeffectively,youmustthoroughlyunderstandconceptssuchassynchronousandasynchronousI/O,diskandtapebuffers,andchannelarchitecture.Whenyouunderstandtheseconcepts,thenyoucanlearnhowtousefixedviewstomonitorbottlenecks,andusethetechniquesdescribedin"TuningRMANBackupPerformance:
Examples"tosolveproblems.
ThereareanumberofconceptsthataffectRMANperformanceandthatcanthereforeinfluenceyourstrategyforbackupperformancetuning:
∙I/OBufferAllocation
∙AllocationofTapeBuffers
∙SynchronousandAsynchronousI/O
∙FactorsAffectingBackupSpeedtoTape
∙UsingtheRATEParametertoControlDiskBandwidthUsage
I/OBufferAllocation
RMANI/Ousestwodifferenttypesofbuffers:
diskandtape.Thesebuffersaretypicallydifferentsizes.Theyareallocateddifferently,dependinguponthedevicetypeandtherolethebufferplaysinanRMANoperation.
AllocationforDiskBuffers
TounderstandhowRMANallocatesbufferstoreaddatafilesduringbackups,youmustunderstandhowRMANmultiplexingworks.
RMANmultiplexingisRMAN'sabilitytoreadanumberoffilesinabackupsimultaneouslyfromdifferentsourcestoimprovereadingperformance,andthenwritethemtoasinglebackuppiece.Thelevelofmultiplexingisthenumberoffilesreadsimultaneously.
Multiplexingisdescribedatgreaterlengthin"MultiplexedBackupSets".Thelevelofmultiplexingisdeterminedbythealgorithmdescribedin"AlgorithmforMultiplexedBackups".Reviewthissectionbeforeproceeding.
WhenRMANbacksupfromdisk,itusesthedatafiledescribedinthefollowingtabletodeterminehowlargetomakethebuffers.
Table14-1DatafileReadBufferSizingAlgorithm
LevelofMultiplexing
ResultingBufferSize
Lessthanorequalto4
RMANallocatesbuffersofsize1MBsothatthetotalbuffersizeforalltheinputfilesis16MB.
Greaterthan4butlessthanorequalto8
RMANallocatesdiskbuffersofsize512KBsothatthetotalbuffersizeforallthefilesislessthan16MB.
Greaterthan8
RMANallocatesafixed4diskbuffersof128KBforeachfile,sothatthetotalsizeis512KBforeachfile.
Thenumberofbuffersallocateddependsonthefollowingrules:
∙Whentheouputofthebackupresidesondisk,4buffersareallocated,theirsizebeingoperatingsystemdependent.
∙Iftheoperationisarestore,andthebackupresidesondisk,4buffersareallocated,theirsizebeingoperatingsystemdependent.
∙Whenrestoringabackup,foreachactivedatafile4buffersof128Kareallocated.
∙Whenimagecopiesareproduced,only4buffersintotalareallocated,eachofanoperatingsystemdependentsize.
AllocationofTapeBuffers
Ifyoubackuptoorrestorefromansbtdevice,thenbydefaultthedatabaseallocatesfourbuffersforeachchannelforthetapewriters(orreadsifdoingarestore).Thesizeofthesebuffersisplatformdependent,butistypically256K.ThisvaluecanbechangedusingtheALLOCATEorSENDcommandusingthePARMSandtheBLKSIZEoption.
Tocalculatethetotalsizeofbuffersusedduringabackuporrestore,multiplythebuffersizeby2,andthenmultiplythisproductbythenumberofchannels.
Forexample,assumethatyouusetwotapechannelsandeachbufferis256K.Inthiscase,thetotalsizeofbuffersusedduringabackupisasfollows:
256KB/bufferx4buffers/channelx2channels=2MB
RMANallocatesthetapebuffersintheSGAifI/Oslavesarebeingused,orthePGAotherwise.
IfyouuseI/Oslaves,thensettheLARGE_POOL_SIZEinitializationparametertosetasideSGAmemorydedicatedtoholdingtheselargememoryallocations.ThispreventsRMANI/ObuffersfromcompetingwiththelibrarycacheforSGAmemory.IfI/OslavesfortapeI/OwererequestedbutthereisnotenoughspaceintheSGAforthem,slavesarenotused,andamessageappearsinthealertlog.
SynchronousandAsynchronousI/O
WhenRMANreadsorwritesdata,theI/Oiseithersynchronousorasynchronous.WhentheI/Oissynchronous,aserverprocesscanperformonlyonetaskatatime.Whenitisasynchronous,aserverprocesscanbeginanI/OandthenperformotherworkwhilewaitingfortheI/Otocomplete.ItcanalsobeginmultipleI/Ooperationsbeforewaitingforthefirsttocomplete.
SomeoperatingsystemssupportnativeasynchronousdiskI/O.Thedatabasetakesadvantageofthisfeatureifitisavailable.OnoperatingsystemsthatdonotsupportnativeasynchronousI/O,thedatabasecansimulateitwithspecialI/OslaveprocessesthatarededicatedtoperformingI/Oonbehalfofanotherprocess.YoucancontroldiskI/OslavesbysettingtheDBWR_IO_SLAVESparametertoanonzerovalue.ThedatabaseallocatesfourbackupdiskI/OslavesforanynonzerovalueofDBWR_IO_SLAVES.
Bycontrast,tapeI/Oisalwayssynchronous.FortapeI/O,eachchannelallocated(whethermanuallyorbasedonaCONFIGUREcommand)correspondstoaserverprocess,calledhereachannelprocess.
SynchronousI/O:
Example
Figure 14-1showssynchronousI/Oinabackuptotape.
Figure14-1SynchronousI/O
Textdescriptionoftheillustrationbradv015.gif
Thefollowingstepsoccur:
1.Thechannelprocesscomposesatapebuffer.
2.Thechannelprocessexecutesmediamanagercodethatprocessesthetapebufferandinternalizesitforfurtherprocessingandstoragebythemediamanager.
3.Themediamanagercodereturnsamessagetotheserverprocessstatingthatithascompletedwriting.
4.Thechannelprocesscaninitiateanewtask.
Figure 14-2showsasynchronousI/Oinatapebackup.AsynchronousI/Ototapeissimulatedbyusingtapeslaves.Inthiscase,eachallocatedchannelcorrespondstoaserverprocess,whichintheexplanationwhichfollowsisidentifiedasachannelprocess.Foreachchannelprocess,onetapeslaveisstarted(ormorethanone,inthecaseofmultiplecopies).
Figure14-2AsynchronousI/O
Textdescriptionoftheillustrationbradv012.gif
Thefollowingstepsoccur:
1.Achannelprocesswritesblockstoatapebuffer.
2.Thechannelprocesssendsamessagetothetapeslaveprocesstoprocessthetapebuffer.Thetapeslaveprocessexecutesmediamanagercodethatprocessesthetapebufferandinternalizesitsothatthemediamanagercanprocessit.
3.Whilethetapeslaveprocessiswriting,thechannelprocessisfreetoreaddatafromthedatafilesandpreparemoreoutputbuffers.
4.Oncethetapeslavechannelreturnsfromthemediamanagercode,itrequestsanewtapebuffer,whichusuallyisready.Thuswaitingtimeforthechannelprocessisreduced,andthebackupiscompletedfaster.
FactorsAffectingBackupSpeedtoTape
Thefollowingfactorsaffectthespeedofthebackuptotape:
∙NativeTransferRate
∙TapeCompression
∙TapeStreaming
∙PhysicalTapeBlockSize
NativeTransferRate
Thetapenativetransferrateisthespeedofwritingtoatapewithoutcompression.Thisspeedrepresentstheupperlimitofthebackuprate.Theupperlimitofyourbackupperformanceshouldbetheaggregatetransferrateofallofyourtapedrives.Ifyourbackupisalreadyperformingatthatrate,andifitisnotusinganexcessiveamountofCPU,thenRMANperformancetuningwillnothelp.
TapeCompression
Theleveloftapecompressionisveryimportantforbackupperformance.Ifthetapehasgoodcompression,thenthesustainedbackuprateisfaster.Forexample,ifthecompressionratiois2:
1andnativetransferrateofthetapedriveis6MB/s,thentheresultingbackupspeedis12MB/s.Inthiscase,RMANmustbeabletoreaddiskswithathroughputofmorethan12MB/sorthediskbecomesthebottleneckforthebackup.
Note:
YoushouldnotusebothtapecompressionprovidedbythemediamanagerandbinarybackupsetcompressionasprovidedbyRMAN.Ifthemediamanagercompressionisefficient,thenitisusuallythebetterchoice.UsingRMANcompressedbackupsetscanbeaneffectivealternativeifyouneedtoreducebandwidthusedtomoveuncompressedbackupsetsoveranetworktothemediamanager,andiftheCPUoverheadrequiredtocompressthedatainRMANisacceptable.
SeeOracle