Documente Academic
Documente Profesional
Documente Cultură
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.
Page 4 of 44
5.
6.
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
NavigatetothedatabasehomepagebyclickingonTargetstab
andthenclickonDatabases.
IfyouseeaLoadMapviewoftheOracledatabases,selecttheSearchListoptiontoview thelistofdatabasesandthenselectdb02.oracle.comfromthelistofdatabases.
Page 7 of 44
2.
WiththeDiagnosticsPacktherearemanynewcapabilitiesincludingdrilldown capabilitiesfromtheHostCPUandActiveSessionsgraph.
Page 8 of 44
3.
IfyouhaveADDMfindingsshowingskiptoStep5.Ifforsomereasontherewereno ADDMFindings,clickonthePerformancetab.
4.
ScrolldownthepagetotheAverageActiveSessionssection.Clickonthe highlighted
icon
5.
6.
Page 9 of 44
AutomaticWorkloadRepository(AWR)isabuiltinrepositoryineveryOracleDatabase. Atregularintervals,thedatabasemakesasnapshotofallitsvitalstatisticsandworkload informationandstorestheminAWR.TheAutomaticDatabaseDiagnosticMonitor (ADDM)analyzestheAWRdataonaregularbasis,thenlocatestherootcausesof performanceproblems,providesrecommendationsforcorrectinganyproblems,and identifiesnonproblemareasofthesystem.BecauseAWRisarepositoryofhistorical performancedata,ADDMcanbeusedtoanalyzeperformanceissuesaftertheevent,often savingtimeandresourcesreproducingaproblem.
Page 10 of 44
7.
Page 11 of 44
8.
Navigatebacktothedatabasehomepagebyclickingonthedatabasesubtabandthen clickonthePerformancesubtablink.
Thispageprovidescomprehensiveinformationneededtoinvestigateanyperformance issues,includingcorrelationwithhostperformance.
Page 12 of 44
9.
10.
Afterreviewingtheavailabledata,changetheViewDataselectorbacktotheRealTime: 15SecondsRefresh.
Page 13 of 44
11.
ClickonCPUUsedonthelegendorontheperformancegraphitselfintheAverage ActiveSessionssections
12.
13.
Click on one of the identifiers located in the SQL ID column in the Top Working SQL section.
Page 14 of 44
14.
ClickontheStatisticstabintheDetailssection
Page 15 of 44
Hereyoucanreviewactivitybytime,bywaits,ExecutionStatisticsthattabulatecritical informationthatwouldhavebeenlaborioustoattainyetsocritical.
15.
ClickonthePlantabintheDetailssection
UndertheDetailssection,choosetheTableradiobuttonhighlightedbelowastheview option.
16.
Page 16 of 44
17.
TIMECHECK:
Ifyouhavelessthan20minutesleftbeforetheendofthelab,SKIPtheoptionalSQLMonitoring taskbelowandgoontothenextsection,TuningPack.
Page 17 of 44
SQLMonitoring(Optional)
18.
Asanalternativemethodtoviewdatabeinggeneratedinrealtime,navigatebackand clickonthePerformanceTab.
19.
ScrolldowntothesectionforAdditionalMonitoringLinksandclickontheSQL Monitoringlink.
YouwillbebroughttotheMonitoredSQLExecutionsinteractivescreen.Thisscreenprovides realtimeinformationonthequeriesthatarecurrentlybeingexecuted.
20.
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
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
2.
3.
Page 23 of 44
Page 24 of 44
4.
ClickonSQLStatementsconsumingsignificantdatabasetimewerefound.
Page 25 of 44
5.
Page 26 of 44
6.
SoTuneitis,navigatetothePerformancesubtab.ScrolltothebottomandselectTop Activity.
Page 27 of 44
7.
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.
Page 29 of 44
11.
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.
Page 34 of 44
18.
19.
SelecttheComprehensiveradiobuttonthenselecttheNextbutton.Leavethe Advancedbuttontodefaults
Page 35 of 44
20.
Timetoschedulethejob.LeavingalltodefaultswillruntheSQLAccessAdvisor immediately,soletdothat.ClicktheNextbutton
ClickonShowAllOptionsbuttonandhavealook.IgnoretheNoFilterOptions.Clickthe Submitbutton.
21.
Page 36 of 44
22.
Page 37 of 44
23.
Wow,lookatthecostsavingsandtheQueryExecutionTimeImprovement.Clickonthe Recommendationssubtab.
Page 38 of 44
24.
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!
31.
32.
SUCCEEDED.Andthatsit
Page 42 of 44
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
Page 43 of 44
Page 44 of 44