Sunteți pe pagina 1din 45

Oracle Enterprise Manager

Oracle Database Performance Diagnostics and Tuning Lab


Session S318965

OracleEnterpriseManager11g OracleDatabaseDiagnosticsandTuning HandsonLab


IntroductiontoEnterpriseManager11g
OracleEnterpriseManager11gisthecenterpieceofOracle'sintegratedITmanagementstrategy,which rejectsthenotionofmanagementasanafterthought.AtOracle,wedesignmanageabilityintoeach productfromthestart,enablingOracleEnterpriseManagertothenserveastheintegratorof manageabilityacrosstheentirestackencompassingOracleandnonOracletechnologies.Fueledbythis uniquevision,OracleEnterpriseManager11ghasintroducedbusinessdrivenITmanagementtohelpIT delivergreaterbusinessvaluethroughthreehighlydifferentiatedcapabilities: Businessdrivenapplicationmanagement,whichcombinesindustryleadingcapabilitiesinreal userexperiencemanagement,businesstransactionmanagementandbusinessservice managementtoimproveapplicationusers'productivitywhileenhancingbusinesstransaction availability Integratedapplicationtodiskmanagement,whichprovidesdeepmanagementacrosstheentire OraclestacktoreduceITmanagementcomplexityandeliminatedisparatepointtools Integratedsystemsmanagementandsupport,whichutilizesindustryfirsttechnologybring supportservicesintotheITmanagementconsole;enablingproactiveITadministration,increased applicationandsystemavailability,andimprovedcustomersatisfaction

GetMaximumPerformanceWithROIof100%
OracleprovidesanintegratedmanagementsolutionformanagingOracledatabasewithauniquetop downapplicationmanagementapproach.Withnewselfmanagingcapabilities,Oracleeliminatestime consuming,errorproneadministrativetasks,sodatabaseadministratorscanfocusonstrategicbusiness objectivesinsteadofperformanceandavailabilityfiredrills. OracleManagementPacksforOracleDatabaseprovidesignificantcostandtimesavingcapabilitiesfor managingOracleDatabases.IndependentstudiesdemonstratethatOracleDatabaseis40percenteasier tomanageoverDB2and38percentoverSQLServer.

DiagnosticsPack
OracleDiagnosticsPack,apartoftheOracleDatabase11gproductset,offersacomprehensivesetof automaticperformancediagnosticsandmonitoringfunctionalitybuiltintocoredatabaseengineand OracleEnterpriseManager.Whetheryouaremanagingoneormoredatabases,OracleDiagnosticsPack offersacomplete,costeffective,andeasytousesolutionformanagingtheperformanceyourOracle Databaseenvironment.WhenusedaspartofEnterpriseManagerGridControl,DiagnosticsPack additionallyprovidesenterprisewideperformanceandavailablereporting,acentralizedperformance repository,andvaluablecrosssystemperformanceaggregation,significantlysimplifyingthetaskof managinglargesetsofdatabases.

Page 1 of 44

TuningPack
OracleTuningPack,apartofOracleDatabase11gproductset,offersanextremelycosteffectiveand easytousesolutionthatautomatestheentireapplicationtuningprocess.EnhancementofSQL performanceisachievedthroughSQLAdvisorsthatareseamlesslyintegratedwiththeEnterprise ManagerDatabaseControlandGridControl,andtogetherprovideacomprehensivesolutionfor automatingthecomplexandtimeconsumingtaskofapplicationtuning.

Thislabwilldemonstrate:
PerformanceDiagnostics Application(SQL)Tuning forOracleDatabase11g. PleasefeelfreetoseekassistancefromtheinstructororOracleDemostaffatanypointintime. Beforewestarttakingyouthroughthedemonstration,pleasenotethefollowing: Youwillbegivenavirtualmachineaddresstouseforthislab.Foreaseofreference,youmay wanttowritethisbelow: VirtualMachineAddress:_________________________________________________________ YouwillconnecttothatsystemusingasimplebrowserconnectionusingFirefox.Theusername andpasswordare: YouwillconnecttothatsystemusingVNC.VNCpasswordisg0Oracle12# OperatingSystemAccounts: oracle/g0Oracle12#androot/g0Oracle12# Database(db02)Accounts: system/oracle1 GridControlAccounts: sysman/oracle1

Page 2 of 44

LABCONFIGURATIONENTERPRISEMANAGERTUNING ANDDIAGNOSTICS
OVERVIEW
Fortheselabexercises,youwillneedthefollowinginfrastructurecomponentstoberunningand available. Database:DB02 Database:EMREP EnterpriseManagerGridControl Wewillstepthroughthesimplifiedversionofstartingthenecessaryinfrastructurecomponentsusingthe desktop. 1. Onthedesktop,navigatetotheOracle_Open_world_2010folder,doubleclickandopenthe contents.

2.

SelecttheEnterprise_ManagementFolder

Page 3 of 44

3.

SelectthefolderTuning_&Diagnosticsfolder.

4.

Next,we'llstartourworkloadrunning.First,clickontheicon'Step1aStartAccessLoad.sh.' Youcanmoveontothenextstepwhiletheterminalwindowdisplays,thisscriptrunsforavery longtimeinaloop.Youmaywanttominimizethewindowforthescript.

Page 4 of 44

5.

Forthesecondpartoftheworkload,clickontheicon'Step1bStartTuningLoad.sh.'Youcan moveontothenextstepwhiletheterminalwindowdisplays,thisscriptrunsforaverylongtime inaloop.Youmaywanttominimizethewindowinwhichthescriptisrunning.

6.

Atthispoint,allofthenecessaryinfrastructureisreadyforyoutomoveforwardwiththeEM Diagnostics&Tuninglabs.Aftercompletionofthelabs,returntothisfolderandtostoptheload onthedatabase,resettheenvironmentandstoptheinfrastructure.Thecompleteinstructions fordoingsoareattheendofthetuninglab.

Page 5 of 44

DiagnosticsPack

IdentifiedChallenge
Diagnosingaslowlyperformingsystemisatimeconsumingtaskoftensurroundedby mythsandlegends,fewofthembasedonfact.Anumberofthirdpartytuningtools areavailabletodaybutfewofthemaregearedtowardsansweringcommon questionssuchas,HowcanImakethebiggestimprovementsinthesystem?or Whyisthesystemslowertodaythanitwaslastweek?Mostproductssimplyprovide agraphicaldisplayofrawdatabasestatistics,leavinguserstodeterminetheroot causeontheirownbydrillingthroughlargeamountsofrawdata.Evenwiththebest oftools,thiscanbeacomplexandtedioustask.

Introduction
AutomaticPerformanceDiagnostic
Diagnosingaslowlyperformingsystemisatimeconsumingtask.OracleDiagnosticsPack11gincludesa selfdiagnosticenginebuiltrightintotheOracleDatabase11gkernel,calledtheAutomaticDatabase DiagnosticMonitor(ADDM).Thisisarevolutionary,firstofitskindperformanceselfdiagnosticsolution thatenablestheOracleDatabase11gtoautomaticallydiagnoseitsperformanceproblems,thereby completelyliberatingadministratorsfromthiscomplexandarduoustask. ADDMperiodicallysamplesthestateofthedatabase,automaticallyidentifiespotentialdatabase performancebottlenecks,andrecommendscorrectiveactions.Thisisalldonewithinafewsecondswith negligibleimpactonoverallsystemperformance.OracleEnterpriseManagerpresentsADDMsfindings andrecommendationsinaconvenientandintuitivefashion,andguidesadministratorsstepbystepto quicklyresolveperformanceproblemsbyimplementingADDMsrecommendations.

Page 6 of 44

A. Overview Inthislabexercise,youwillaccomplishthefollowing: 1. TopDownAutomaticDiagnostic 2. ReviewedADDMFindings 3. ReviewedPerformanceAnalysis 4. DeepDiveDiagnosticintoSQLPerformance B. Setup&Preparation 1. OpenupabrowserandLogintoGridControlusingsystemastheusernameand passwordoracle1

NavigatetothedatabasehomepagebyclickingonTargetstab

andthenclickonDatabases.

IfyouseeaLoadMapviewoftheOracledatabases,selecttheSearchListoptiontoview thelistofdatabasesandthenselectdb02.oracle.comfromthelistofdatabases.

Page 7 of 44

2.

WiththeDiagnosticsPacktherearemanynewcapabilitiesincludingdrilldown capabilitiesfromtheHostCPUandActiveSessionsgraph.

ClickontheADDMFindingsvalueunderDiagnosticSummaryintheDatabasehome page.WhenpromptedfortheDatabaseLogin,usesystem/oracle1andclickonthe Loginbutton.

Page 8 of 44

3.

IfyouhaveADDMfindingsshowingskiptoStep5.Ifforsomereasontherewereno ADDMFindings,clickonthePerformancetab.

4.

ScrolldownthepagetotheAverageActiveSessionssection.Clickonthe highlighted

icon

5.

YouwillbetakentotheAutomaticDatabaseDiagnosticMonitor(ADDM)Advisor Centralscreen.Onthisscreen,clickonthe icon.ClickontheIconKeytoviewthe ADDMTaskandSnapshoticons.

6.

Byclickingonthenumericlinkorthroughthealternativepath,youcannowdrilldown intoADDMFindings.Thedatabase,bydefault,startstakingscheduledsnapshotsofthe databaseandstorestheminarepository,AutomaticWorkloadRepository(AWR).

Page 9 of 44


AutomaticWorkloadRepository(AWR)isabuiltinrepositoryineveryOracleDatabase. Atregularintervals,thedatabasemakesasnapshotofallitsvitalstatisticsandworkload informationandstorestheminAWR.TheAutomaticDatabaseDiagnosticMonitor (ADDM)analyzestheAWRdataonaregularbasis,thenlocatestherootcausesof performanceproblems,providesrecommendationsforcorrectinganyproblems,and identifiesnonproblemareasofthesystem.BecauseAWRisarepositoryofhistorical performancedata,ADDMcanbeusedtoanalyzeperformanceissuesaftertheevent,often savingtimeandresourcesreproducingaproblem.

Onthispageyoucanreviewhistoricaldatabaseactivity.Bydefault,thecurrentADDM performanceanalysisfindingsarepresented.IfyouwanttolookatadifferentADDM period,clickontheappropriateiconbelowthechart.ThePerformanceAnalysissection displaysthefindingsaswellasthepotentialimpactforresolvingtheidentifiedissues.

Page 10 of 44

7.

GoaheadandclickononeoftheFindingdescriptionlinks,e.g.CPUUsage,intheADDM PerformanceAnalysissectiontoreviewdetails(shownbelow).NoticetheBenefit(%) columniftheactionistakentofixtheissue.ButdontstartfixinganythingIknowyou wantto,butwewilltuneinthenextlab!

Analternativewaytodiagnoseperformanceissuesistoreviewthedatabase performanceovertimeanddrillintoanyabnormalitiesindicatedontheperformance charts.

Page 11 of 44

8.

Navigatebacktothedatabasehomepagebyclickingonthedatabasesubtabandthen clickonthePerformancesubtablink.

Thispageprovidescomprehensiveinformationneededtoinvestigateanyperformance issues,includingcorrelationwithhostperformance.

Page 12 of 44

9.

Bydefault,theperformancepageissettorealtimewithautomaticrefresh.Thisoption isontheupperrightcornerofeverypage.Tolookbackintime,changeViewDatadrop downlisttoHistorical

10.

Afterreviewingtheavailabledata,changetheViewDataselectorbacktotheRealTime: 15SecondsRefresh.

Page 13 of 44

11.

ClickonCPUUsedonthelegendorontheperformancegraphitselfintheAverage ActiveSessionssections

12.

OntheActiveSessionsWorkingchart(shownbelow),theshadedtimeperiodcanbe draggedtodifferenttimeperiods.ClickanddragtheshadedboxontheActiveSession charttofocusonadifferentperiodoftime.Noticehowthesupportingdetailschange. ThispageshowsthewaitscausingCPUissuesaswellasTopSQLandTopSessions contributingtotheCPUissuesforthatperiod.

13.

Click on one of the identifiers located in the SQL ID column in the Top Working SQL section.

Page 14 of 44

TheSQLStatementisdisplayedinadditiontoalltheassociatedactivitylinkedtothis SQL.ThisishowyoucanspotanddrilldownonoffendingSQL.Similarlytotheprevious performancecharts,theshadedblockcanbedraggedbackwardintimetoreviewpast activity. RemembertodragtheshadedblocktotherighttodisplaytheoffendingSQLproducing thehighloadasahyperlink.

14.

ClickontheStatisticstabintheDetailssection

Page 15 of 44

Hereyoucanreviewactivitybytime,bywaits,ExecutionStatisticsthattabulatecritical informationthatwouldhavebeenlaborioustoattainyetsocritical.

15.

ClickonthePlantabintheDetailssection

UndertheDetailssection,choosetheTableradiobuttonhighlightedbelowastheview option.

16.

Page 16 of 44

17.

ReviewthePlanoftheSQLthatiscausingperformanceissues.Noticethesignificant amountofCPUbeingusedtoperformthisSQLstatement.Inadditiontothebreakdown anddetailsoftheSQLitself,otherimportantstatistics,explainplansandother informationisavailableforreviewandanalysis.

TIMECHECK:
Ifyouhavelessthan20minutesleftbeforetheendofthelab,SKIPtheoptionalSQLMonitoring taskbelowandgoontothenextsection,TuningPack.

Page 17 of 44

SQLMonitoring(Optional)

18.

Asanalternativemethodtoviewdatabeinggeneratedinrealtime,navigatebackand clickonthePerformanceTab.

19.

ScrolldowntothesectionforAdditionalMonitoringLinksandclickontheSQL Monitoringlink.

YouwillbebroughttotheMonitoredSQLExecutionsinteractivescreen.Thisscreenprovides realtimeinformationonthequeriesthatarecurrentlybeingexecuted.

20.

RightclickontheSQLIDtoshowtheoptionavailable.Youhavealreadyviewedsomeof thescreensinthisexercisefortheoptions:SQLText,SQLDetails,andSessionDetails. Thisprovidesanadditionalalternativepathtoreachthisinformation.Clickonthe MonitoredSQLExecutionDetailsfromthemenu.

Page 18 of 44

21.

Hover,highlightandviewthelinksandinformationavailableonthisscreentodrillinto.

C. Summary WelookedathowtheDiagnosticsPack,withtheusedofAutomaticDatabaseDiagnosticMonitor(ADDM) automaticallygetsenabledwhenadatabaseiscreatedandstarted.Itwillperformtopdownanalysisof databaseactivityusingtheautomaticsnapshotscratedandstoredintheAutomaticWorkloadRepository. ADDMidentifiesresourceintensiveoperationsanddetermineswhetherornotthesecomponentsor operationsareactingasperformancebottlenecks.ADDMthendiagnosesthesepotentialproblemsand providesadvice. WealsolookedintothePerformanceAnalysisandTopActivityfeatureandwereabletogobackintime toviewwhatwasoccurringinthedatabase. WethendrilleddownintoindividualSQLsandlookedattheirperformancemetrics. 1. Youaccomplishedthefollowinginthislabexercise: i) ReviewedTopDownAutomaticDiagnostic ii) ReviewedADDMFindings iii) ReviewedPerformanceAnalysis iv) ReviewedDeepDiveDiagnosticintoSQLPerformance 2. AdditionalInformation i) Formoreinformation,see: Page 19 of 44

(1)

http://www.oracle.com/technology/products/oem/pdf/diagnostic pack11gdatasheet.pdf

Page 20 of 44

TuningPack
IdentifiedChallenge Fordatabaseadministratorsandapplicationdevelopers,applicationtuningisa criticallyimportantareaandaconsiderableamountoftheirtimeisspent performingthisveryimportantfunction.Apoorlytunedbusinessapplicationcan potentiallyaffectnotjustafewusersbutanentirebusinessoperationandfor thisreasoncompaniesinvestsignificantresourcestoensuresmoothrunningof applicationsvitalfortheirbusinesses.

Introduction
OracleTuningPack,apartofOracleDatabase11gproductset,offersanextremelycosteffectiveand easytousesolutionthatautomatestheentireapplicationtuningprocess.EnhancementofSQL performanceisachievedthroughSQLAdvisorsthatareseamlesslyintegratedwiththeEnterprise ManagerDatabaseControlandGridControl,andtogetherprovideacomprehensivesolutionfor automatingthecomplexandtimeconsumingtaskofapplicationtuning.

SQLTuningAdvisor
ManualSQLtuningisacomplexprocessthatpresentsmanychallenges.Itrequiresexpertiseinseveral areas,isverytimeconsuming,andrequiresanintimateknowledgeoftheschemastructuresandthedata usagemodeloftheapplication.AllthesefactorsmakemanualSQLtuningachallengingandresource intensivetaskthatisultimatelyveryexpensiveforbusinesses. SQLTuningAdvisorisOraclesanswertoallthepitfallsandchallengesofmanualSQLtuning.It automatestheSQLtuningprocessbycomprehensivelyexploringallthepossiblewaysoftuningaSQL statement.Theanalysisandtuningisperformedbythedatabaseenginessignificantlyenhancedquery optimizer.FourtypesofanalysisareperformedbytheSQLTuningAdvisor: StatisticsAnalysis:Thequeryoptimizerneedsuptodateobjectstatisticstogenerategood executionplans.Inthisanalysisobjectswithstaleormissingstatisticsareidentifiedand appropriaterecommendationsaremadetoremedytheproblem. SQLProfiling:Thisfeature,introducedinOracleDatabase10g,revolutionizestheapproachto SQLtuning.TraditionalSQLtuninginvolvesmanualmanipulationofapplicationcodeusing optimizerhints.SQLProfilingeliminatestheneedforthismanualprocessandtunestheSQL statementswithoutrequiringanychangetotheapplicationcode.ThisabilitytotuneSQL withoutchangingtheapplicationcodealsohelpssolvetheproblemoftuningpackaged applications.Packagedapplicationusersnownolongerneedtologabugwiththeapplication vendorandwaitforseveralweeksormonthstoobtainacodefixfortuningthestatement.With SQLprofilingthetuningprocessisautomaticandimmediate. AccessPathAnalysis:IndexescantremendouslyenhanceperformanceofaSQLstatementby reducingtheneedforfulltablescans.Effectiveindexingis,therefore,acommontuning technique.Inthisanalysisnewindexesthatcanbesignificantlyenhancequeryperformanceare identifiedandrecommended.

Page 21 of 44

SQLStructureAnalysis:ProblemswiththestructureofSQLstatementscanleadtopoor performance.Thesecouldbesyntactic,semantic,ordesignproblemswiththestatement.Inthis analysisrelevantsuggestionsaremadetotherestructureselectedSQLstatementsforimproved performance.

Theoutputofthisanalysisisintheformofrecommendations,alongwitharationaleforeach recommendationanditsexpectedperformancebenefit.Therecommendationrelatestocollectionof statisticsonobjects,creationofnewindexes,restructuringoftheSQLstatement,orcreationofaSQL Profile.AusercanchoosetoaccepttherecommendationtocompletethetuningoftheSQLstatements. TheSQLTuningAdvisoroffersapowerful,intuitive,anduserfriendlywayforperformingSQLtuning. TuningofSQLstatementsnolongerhastobethedomainofexperts.Oraclehasbuiltatuningexpert insidethedatabaseenginetoperformthisveryimportantfunctionforthedatabaseadministratorsina fractionofthetimeandcostneededtocarryoutthesametaskmanually.

SQLAccessAdvisor
Thedesignofthedatabaseschemacanhaveabigimpactontheoverallapplicationperformance.SQL AccessAdvisor,providescomprehensiveadviceonhowtooptimizeschemadesigninordertomaximize applicationperformance.SQLAccessandSQLTuningAdvisors,together,provideacompletesolutionfor tuningdatabaseapplications.Thesetwoadvisorsautomateallmanualtuningtechniquescurrently practicedandformthecoreofOraclesautomaticSQLtuningsolution. TheSQLAccessAdvisoracceptsinputfromallpossiblesourcesofinterest,suchasthecursorcache,the AutomaticWorkloadRepository(AWR)anyuserdefinedworkload,andwillevengenerateahypothetical workloadifaschemacontainsdimensionsorprimary/foreignkeyrelationships.Itcomprehensively analyzestheentireworkloadandprovidesrecommendationstocreatenewpartitionsorindexesif required,dropanyunusedindexes,createnewmaterializedviewsandmaterializedviewlogs. Determiningtheoptimalpartitioningorindexingstrategyforaparticularworkloadisacomplicated processthatrequiresexpertiseandtime.SQLAccessAdvisorconsidersthecostofinsert/update/delete operationsinadditiontothequeriesontheworkloadandmakesappropriaterecommendations, accompaniedbyaquantifiablemeasureofexpectedperformancegainaswellasscriptsneededto implementtherecommendations. TheSQLAccessAdvisortakesthemysteryoutofaccessdesignprocess.Ittellstheuserexactlywhatthe typeofindexes,partitions,andmaterializedviewsarerequiredtomaximizeapplicationperformance.By automatingthisverycriticalfunction,SQLAccessAdvisorobviatestheneedfortheerrorprone,lengthy, andexpensivemanualtuningprocess.Itisfast,precise,easytouseand,togetherwiththeSQLTuning Advisor,offersthemostaccurateandcosteffectivesolutionforapplicationperformancetuning.

Page 22 of 44

A. Overview Inthislabexercise,youwillaccomplishthefollowing: 1. CreatedSQLTuningSets 2. UsedSQLTuningAdvisortorecommendimprovementsonSQLs 3. UsedSQLAccessAdvisortorecommendimprovementsonschemastructures 1. OpenupabrowserandLogintoGridControlusingsystemastheusernameand passwordoracle1

2.

IfyouarecontinuingonfromtheDiagnosticsLab,wehaveseenhowquicklyweareable totriagetheperformancebottleneckbytheoneofitskind,AutomaticDatabase DiagnosticMonitoring.Wewerealsoabletolookdeepintotheculpritusingthe PerformanceAnalysispageandlookatkeyperformancemetrics. Soletuscontinueandfixtheissue. Navigatetoyourdatabasedb02.oracle.comhomepageandclickonthenumericcount link(inthiscase2)ofADDMFindings.

3.

Page 23 of 44

Page 24 of 44

4.

ClickonSQLStatementsconsumingsignificantdatabasetimewerefound.

Page 25 of 44

5.

WeseebelowthatADDMhasalreadyidentifiedtheSQLsthatarecausingthe performancebottleneckandfromthisscreenwecandirectlynavigatetothefeaturesof theTuningPackhere,SQLTuningAdvisor. However,wait,wewilldoonebetter,wewilluseSQLTuningSets.Acontainerthat allowsustoaccumulatemultipleDMLswithcontextdirectlythroughcursorcache.No needtoSQLTrace,letstune!

Page 26 of 44

6.

SoTuneitis,navigatetothePerformancesubtab.ScrolltothebottomandselectTop Activity.

Page 27 of 44

7.

IntheTopSQLsection,changetheActionsdropdowntoCreateSQLTuningSet.Click thecheckboxnexttotheSQLIDs(twoorthreeofthem)andclickontheGobutton. Note:BeforecreatingaSQLtuningset,youmayneedtomovethehistoricalslide(grey area)backtoatimewhentheworkloadispeak.Ifthecurrenttimehappenstobeina "valley",youmayonlygetoneSQLstatementintheTuningset.

ASQLTuningSet(STS)isadatabaseobjectthatincludesoneormoreSQLstatements alongwiththeirexecutionstatisticsandexecutioncontext,andcouldincludeauser priorityranking.TheSQLstatementscanbeloadedintoaSQLTuningSetfromdifferent SQLsources,suchastheAutomaticWorkloadRepository,thecursorcache,orcustomSQL providedbytheuser.AnSTSincludes: AsetofSQLstatements Associatedexecutioncontext,suchasuserschema,applicationmodulenameand action,listofbindvalues,andthecursorcompilationenvironment Associatedbasicexecutionstatistics,suchaselapsedtime,CPUtime,buffergets, diskreads,rowsprocessed,cursorfetches,thenumberofexecutions,thenumber ofcompleteexecutions,optimizercost,andthecommandtype SQLstatementscanbefilteredusingtheapplicationmodulenameandaction,oranyofthe executionstatistics.Inaddition,theSQLstatementscanberankedbasedonany combinationofexecutionstatistics.

Giveameaningful,(anduniqueifyouarerunningthroughthislabagain),Nameto provideeasyidentificationandclicktheOKbutton

8.

Page 28 of 44

YoushouldarriveintheSQLTuningSetspagewhenstep8completes.SelecttheSQL TuningSetyoujustcreatedandclickontheScheduleSQLTuningAdvisortab.

9.

10.

MakesuretheSQLTuningSetisentered,ifnot,selecttheflashlighticonandselectyour tuningset.Also,ifyoudecidetochangetheName,makesureitisunique.Leave everythingelsedefaultandselecttheSubmitbutton

Page 29 of 44

11.

ViewtherecommendationsontheSQL(select/*+ORDEREDUSE_NL(c)FULL (c)*/count(*)fromsh.saless,sh.customerscwherec.cust_id=s)byselectingthe appropriateradiobuttonandclickingontheViewbutton.

NoticethattherearerecommendationsforcollectingstatisticsandimplementingaSQL Profile.ClickontheCompareExplainPlans,thebeforeandafterplansoftheSQLifwe implementedtheSQLProfile.Letsimplementthisrecommendation,onebyoneselect theradiobuttonandselectingtheImplementbuttonontheConfirmationscreen. (Dependingonhowlongyouhavebeenrunningtheload,youmaynotseetheStatistics. YoumayonlygetonerowforSQLProfile).

12.

Page 30 of 44

andforthesecond

13.

OncetheSQLProfilehasbeenimplemented,clickontheAdvisorCentralbreadcrumbto returntotheAdvisorCentralhomepage.

Page 31 of 44

14.

ClickontheSQLAdvisorlinkintheAdvisorCentral

TIMECHECK:
Ifyouhavelessthan5minutesleftbeforetheendofthelab,SKIPtheoptionalSQLAccess AdvisorsectionbelowandgototheSummarysectioninthelastpage.

Page 32 of 44

SQLAccessAdvisor(Optional)

15.

WelookedfirstattheSQLTuningAdvisor;wewillnowworkwithSQLAccessAdvisor, anotherfeatureofTuningPack.ClickontheSQLAccessAdvisor.

Page 33 of 44

16.

MakesureRecommendnewaccessstructuresisselectedandclicktheContinuebutton

17.

SelecttheUseanexistingSQLTuningSetradiobuttonandclickontheFlashlightto selecttheSQLTuningSetyoucreatedearlier. LeavetheFiltersettingtodefaultsandclicktheNextbutton

Page 34 of 44

18.

Forthepurposeofthislab,letusjustselecttheIndexescheckbox,knowingthatwe couldalsogetSQLAccessAdvisortorecommendonMaterializedViewsand Partitioning.

19.

SelecttheComprehensiveradiobuttonthenselecttheNextbutton.Leavethe Advancedbuttontodefaults

Page 35 of 44

20.

Timetoschedulethejob.LeavingalltodefaultswillruntheSQLAccessAdvisor immediately,soletdothat.ClicktheNextbutton

ClickonShowAllOptionsbuttonandhavealook.IgnoretheNoFilterOptions.Clickthe Submitbutton.

21.

Page 36 of 44

22.

LetshavealookatwhatSQLAccessAdvisorhasrecommended.ClickonViewResults buttononcetheStatusshowscompleted.Makesureyouhavetheradiobuttonselected foryourNamecolumn

Page 37 of 44

23.

Wow,lookatthecostsavingsandtheQueryExecutionTimeImprovement.Clickonthe Recommendationssubtab.

Page 38 of 44

24.

TherearetwoRecommendationsforImplementationatthebottomofthepage identifiedbytheIDcolumn.LetustakealookatID1first.Clickonthelinkassociated withID1.

ReviewtheRecommendationofcreatinganindexintheSHschemathatwillhelpthe SQLidentifiedbelow.ImplementingtheRecommendationwillresultinan improvement.Howaboutthesecondrecommendation??

25.

Page 39 of 44

26.

Goback(justclickthebackbrowserbutton)andselectID2

27.

ReviewRecommendation:2.AnotherindexcreationinSH1schemawithacost improvementofabout18%

Page 40 of 44

28.

SoletgobacktotheRecommendationpageandimplementthetwoindexcreationsby selectingthecheckboxesandclickingontheScheduleImplementationbutton.

29.

YoushouldseetheScheduleImplementationpage.MakesuretheStoponErroris checkedandclickonSubmitbutton.

Page 41 of 44

30.

Excellentjob!

LetsseehowtheJobisprogressingasweleftthedefaultstarttimeasImmediatewhile scheduling.GotothedatabaseServersubtabandclickontheJobslink.Youmayneed toclickontheRefreshbuttonintheSchedulerJobsscreen.

31.

32.

SUCCEEDED.Andthatsit

Page 42 of 44

WewentthroughtwokeyfeaturesoftheTuningPack,SQLTuningAdvisorandSQLAccessAdvisorafter identifyingthequeriesthatwerethemajoritycauseofCPUbottleneckonthehost.Weencapsulatedwith context,thesequeriesintouniqueSQLTuningSet(STS). RunningtheSQLTuningAdvisor,onthereferenceSTS,wediscoveredthattherewerestalestatistics, whichwefixedbygatheringstatisticsonthenecessaryobjects.Thenwediscoveredasuboptimumplan ofaSQL,whichwefixedbyimplementingaSQLProfile. WethenranSQLAccessAdvisoronthereferenceSTS,whichrecommendedimplementingtwoindexesin twoschema,whichweimplemented,andvoila,improvementsalready.Newsessionswillnowtake advantageofourtuningefforts.

B. Summary

1.

2.

Youaccomplishedthefollowinginthislabexercise: i) CreatedSQLTuningSets ii) UsedSQLTuningAdvisortorecommendimprovementsonSQLs iii) UsedSQLAccessAdvisortorecommendimprovementsontheSchema AdditionalInformation i) Formoreinformation,see: (1) http://www.oracle.com/technology/products/oem/pdf/tuningpack 11gdatasheet.pdf

ThisconcludestheOracleEnterpriseManagerHandsonLab. Additionalinformationcanbefoundat: DiagnosticsandTuningPacksdemoboothslocatedatOracleMosconeWest

Page 43 of 44

Foradditionalinformation,visit: OracleDatabaseManageability: http://www.oracle.com/technetwork/database/features/manageability/index.html OracleEnterpriseManager http://www.oracle.com/enterprise_manager/index.html

Page 44 of 44

S-ar putea să vă placă și