Вы находитесь на странице: 1из 6

3/5/2015

GATHERAUTO|Jithin'sOracleTuningCorner

Jithin'sOracleTuningCorner
TheOracleWeblog
stayupdatedviarss

PostsTaggedGATHERAUTO

GATHERAUTOvsGATHERSTALEinOracle11.2
Posted:February23,2015inOracleDatabasePosts
Tags:11.2.0.4,DBMS_STATS,GATHERAUTO,GATHERSTALE,OracleDatabase11g
0
WhenusingDBMS_STATStogatherstatistics,weneedamethodtochoosewhichobjectsto
gatherstatisticsfor.ThisisdonebytheparameterOPTIONS.Thepossiblevaluesforthis
parameterare
GATHER
GATHERAUTO
GATHERSTALE
GATHEREMPTY
LISTAUTO
LISTEMPTY
LISTSTALE
Oftheabove,GATHERAUTO&GATHERSTALEconfusemanyletsseewhatsthemain
differencebetweenthetwo.
GATHERSTALE:Oraclegathersstatisticsonstaleobjectsasdeterminedbylookingatthe
*_tab_modificationsviews.Theestimatepercent&degreehavetobeprovidedbytheuser.
GATHERAUTO:Oracledecideswhichobjectstogatherfreshstatisticsforandalsodecides
howtogetthem.Oracledeterminestheestimatepercenttobeused.Theparallelismusedis
basedontheinit.orasetting.Thisalsoused*_TAB_MODIFICATIONStodecideontheeligible
candidates.
FootNote:
In12c,OraclehasdoneawaywithmostoftheseandprovidesonlyGATHERandGATHER
AUTO
http://oracletuningcorner.com/tag/gatherauto/

1/6

3/5/2015

GATHERAUTO|Jithin'sOracleTuningCorner

Reference:
https://docs.oracle.com/database/121/ARPLS/toc.htm
(https://docs.oracle.com/database/121/ARPLS/toc.htm)
http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_stats.htm#CIHBIEII
(http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_stats.htm#CIHBIEII)

GatherSchemaStatisticsonEBS11.5.8with
GatherAuto
Posted:September4,2009inApplication/EBSTuning,PerformanceTuning
Tags:11.5.8,11.5.9,DBMS_STATS,FND_STATS,GATHERAUTO,
GATHER_SCHEMA_STATS,GSS
0
RecentlyaclientofourswhosonEBS11.5.8and9icameupwitharequesttorunGather
SchemaStatisticswiththeGatherAutoOptionwithoutsettingstatistics_levelastypical.Yes,
youheardmeright.
Imetwithmanyroadblocksinthiscourseandnowfinally,Ihaveovercomeallthese.Belowis
averybriefpointersonhowIwentaboutit.ThereasonIampostingthisisthatIseemayhits
whichcomefromGooglewiththeSearchItemEBS11.5.8GatherStatsinmyhitcounter.So
therearepeopleouttherewhoarelookingforsimilarsolutions.
IanalyzedtheFND_STATSpackagewhichiscalledbytheprogramGatherSchemaStatistics
(GSS).Uponthis,IfoundthatFND_STATSisactuallyawrapperforDBMS_STATSpackage.
DBMS_STATSpackageisthedbpackagewhichenablesstatisticsgathering.FND_STATSadds
extravalidationandafewimportantfunctionalitiestotheDBMS_STATS.AsperOracle;we
requiretheparameterstatistics_leveltobesettotypicalinordertouseGATHERAUTO.
AnalyzingtheFND_STATSshowedthatwheneverGatherSchemaStatisticsisrunwith
GATHERAUTOparameter,thepackageactuallygetsalistoftableswhichdonothave
MONITORINGenabledandthenitproceedstogatherstatsforalltablesinthislist@an
estimatepercent10andoptionasGATHER.ItwillthenexecuteandALTERSESSION
statementwhichwillenablemonitoringforthistable.Thismeansfromthatpointoftime,data
willbegatheredinall_tab_modificationstableontheINSERT/UPDATE/DELETEactiononthe
saidtable.
Whatthismeansforus:WecanrunGSSwithGATHERAUTOoptionanditwillinthefirst
rundotwothings:
a.Gatherstatsat10%forALLtablessatisfyingcertaincriteria.
b.EnableMONITORINGforalltablesinabovestep.

ItriedrunningthenormalGSSwithGATHERAUTOandthesomerequestcompletedwhile

http://oracletuningcorner.com/tag/gatherauto/

2/6

3/5/2015

GATHERAUTO|Jithin'sOracleTuningCorner

ItriedrunningthenormalGSSwithGATHERAUTOandthesomerequestcompletedwhile
someerroredout.UponanalyzingtheerroredSCHEMAS,itwasfoundthattheyerroredout
becausethesessioncouldnotgetaLOCKwithNOWAITclausewhichmeantthatcertain
tablesinthoseschemaswerebeingaccessed&lockedbyanotherprocesswhenthishappened.
IwentbacktoFND_STATSwrapperanddeducedthelogicwhichitusedtogetthelistof
tablesandenableMONITORING.Ithenwroteascriptwhichwoulddothisformeschemaby
schema.IwasabletoupdatealltablesexceptthoseinAPPLSYSschema.Thisisbecauseonce
theEBSApplicationisup,itwillcontinuouslyaccesscertaintableslike
FND_CONCURRENT_PROCESSES,FND_CONCURRENT_QUEUES,
FND_CONCURRENT_REQUESTSetc.Iranthisscriptwiththeapplication(incl.CCM)down
andalltableswasupdated.
IrantherequestsetwithLISTAUTOparameter(thiswilllistoutallthetablesforwhichstats
wouldbegatheredifweuseGATHERAUTO).Tomysurprise,itdidnotlistasingletable
whereasideallyitshouldhavelistedanumberoftables.Then,asearchonmetalinkpointed
metoaBugwhichcausedoracletoignorethedefaultvalueof10fortheparameter
modificationsthreshold.Thisparameterisresponsiblefordeterminingthecutoff%change
inatableafterwhichstatswouldbegatheredforit.Therearenotpatchesasofnow;howevera
workaroundexistsandIimplementedit.(youjusthavetomanuallyenterthevalueinsteadof
leavingitblankforOracletodefaultit;neatha?)IrantheGSSrequestsetwithLISTAUTO
againanditpickedupmanytables.ThenIsubmittedtheGSSwithGATHERAUTOoption.
Theprogramcompletedsuccessfully.
Conclusion:
HereIhaverunGSSwithGATHERAUTOatadefaultmodificationsthresholdof10%.In
differentenvironmentswemightneedtohavedifferentvaluesforthisparameterforasetof
tableswhichareverydynamic.Thislistcanbededucedbymonitoringtheperformanceofthe
Applicationoveraperiodoftime.
Thispostissupposedtobeapointerforpeopleouttherewhoaretryingtoachievesomething
similar.Alsoalsoanote:FND_STATScanbecanbecustomizedtoreflectacustomersown
needs.ThoughthisisnotsupportedbyOracle,noharmindoingthisinanalreadydesup
version.Letmeknowifanyofyouareinterested.

GatherSchemaStatsinOracleEBS11.5.10
Posted:August16,2009inApplication/EBSTuning,PerformanceTuning
Tags:11.5.10,11.5.8,11.5.9,DBMS_STATS,FND_STATS,GATHERAUTO,
GATHER_SCHEMA_STATS,GSS
0
OracleEBusinessSuite(EBS)hasaconcurrentprogramcalled
GATHER_SCHEMA_STATISTICSwhichisusedtogatherstatsforthesmoothfunctioning
oftheCBO(CostBasedOptimizer).ItusesFND_STATS,whichisbasicallyawrapperaround
http://oracletuningcorner.com/tag/gatherauto/

3/6

3/5/2015

GATHERAUTO|Jithin'sOracleTuningCorner

DBMS_STATS.Inthisarticle,IwillexplainthebasicworkingoftheFND_STATSanddifferent
optionsavailable.Ihaveomittedtheexplanationontheinputparameterswhichthis
procedure/programtakesandinsteadhaveconcentratedonthelogicwhichituses.
Thedetailsspecifiedaretakesfroma11.5.10EBSversion.ButAFSIK,itisequallyapplicablein
11.5.9aswell.
_FND_STATS.GATHER_SCHEMA_STATS_
Ifoptions=GATHER
Selectlistoftableswhichsatisfythefollowingcriteria:
1)dba_tables.iot_typeIOT_OVERFLOWoriot_typeisnull
2)Tableisnotatemporarytable
3)Itisnotanexcludedtable(determinedfromfnd_stats_histandfnd_exclude_table_stats)
ItthencallstheFND_STATS.GATHER_TABLE_STATS.Thefunctioningofthisprocedureis
describedtowardstheendofthiswriteup.
Ifoptions=GATHERAUTO
1)Fordb_versionsabove8.1flushdbmonitoringinfofromSGAtothedba_tab_monitoring
tables.Elseusewhateverdataisavailableindba_tab_monitoringtables
2)Selectalistoftablesatisfyingthefollowingcriteria:
a.dba_tab_modifications.table_owner=upper(schemaname)
b.(nvl(dtm.inserts,0)+nvl(dtm.updates,0)+nvl(dtm.deletes,0))>
modpercent*nvl(dt.num_rows,0))/100
Wheremodpercent(defaultvalue=10)isthethresholdlevelofstalenessafterwhichatable
shouldbepickedforStatsgathering.Thisvaluecanbepassesfromtheconcurrentprogram.
ThisishowthewrappercancontrolthethresholdlevelsasopposedtotheDBMS_STATS
packagewherethresholdisfixedat10%.
Thelogicoftheselectqueryissuchthattherecanbesomeredundantstatsgatheringonefor
thetableandanotherforthepartition,whenbothhavestaledata.Anotesaysthatsuch
scenariowillbeveryrareandthecodewillberevisitedinfutureifneeded.
3)ItsubmitstheFND_STATS.GATHER_TABLE_STATSforeachtable,partitioninthelistof
tablesinstep2.
4)GATHERAUTOincludesGATHEREMPTY,sostatsaregatheredonanyunanalyzedtables
and/orindexes.Thisisdeterminedfromthedba_tab_modifications.last_analyzed=NULL.In
caseofindexes,itisdba_indexes.last_analyzed=NULL

5)Checkifthereareanytablesintheschemawhichdoesnothavemonitoringenabled.Ifyes, 4/6

http://oracletuningcorner.com/tag/gatherauto/

3/5/2015

GATHERAUTO|Jithin'sOracleTuningCorner

5)Checkifthereareanytablesintheschemawhichdoesnothavemonitoringenabled.Ifyes,
gatherstatsforthemusing10%andenablemonitoringforsuchtablessothatwehavedatafor
themindba_tab_modificationsfornexttime.
Foroptions=LISTAUTO
Itwritesthelistoftablesinstep2tothelogfile
Foroptions=GATHEREMPTY
Itdoesgatherstatsforanyunanalyzedtablesand/orindexeswhicharenotexcludedintothe
logfile.
Foroptions=LISTEMPTY
Itwritesthelistofanyunanalyzedtablesand/orindexeswhicharenotexcludedintothelog
file
Iftheschema_name=ALL
ItwillrecursivelysubmitFND_STATS.GATHER_SCHEMA_STATSforallschemassatisfying
thebelowconditions:
1)Theschemashouldhaveavalidentryinthefnd_product_installationstable.Thismeans
peoplemigratingfrom11.5.8,11.5.9to11.5.10,willhavetoreregistertheircustomapplications
infnd_product_installationsforthemtobepickedbyGatherSchemaStatistics&schemaname
=ALL
Ifschema_name=SYS
ItwillgiveerrorsayingGatheringstatisticsontheSYSschemausingFND_STATSisnot
allowed.PleaseuseDBMS_STATSpackagetogatherstatsonSYSobjects.
_FND_STATS.GATHER_TABLE_STATS_
1)Forbetterperformance,tablessmallerthansmall_tab_for_par_tholdshouldbegatheredin
serial
2)Forbetterstats,tablessmallerthansmall_tab_for_est_tholdshouldbegatheredat100%.
3)Ifdb_versn>=9.2thenBuildupthemethod_optifhistogramcolsarepresent.
method:=method||||x.column_name||SIZE||x.hsizethiswillgivesomethinglike
FORALLCOLUMNSSIZE1
4)Ifnohistogramcolsthennullifymethod,elsecallitwithhistogramcols.
5)Ifversionispre9.2,usetheoldmethodofcallingtwice.
Thereareafewothercheckswhichdonothaveanysignificanceinthecurrentcontext.The
procedurethencallsanotherprocedureXXX,whichisaPrivatepackagethatnowcalls
DBMS_STATS.GATHER_TABLE_STATSdynamicallydependingupontheversionofthe
http://oracletuningcorner.com/tag/gatherauto/

5/6

3/5/2015

GATHERAUTO|Jithin'sOracleTuningCorner

database.For8i,dbms_statsiscalledasbefore,forhigherversions,itiscalledwiththe
no_invalidateflag.
So,inshort,theGatherSchemaStatisticsconcurrentprograminternallysubmits
DBMS_STATS.GATHER_TABLE_STATSforeacheligibletableinthatparticularschema.
Bloggedby:JithinSarath

JithinsOracleTuningCorner

BlogatWordPress.com.TheGreyzedTheme.
Follow

FollowJithin'sOracleTuningCorner
BuildawebsitewithWordPress.com

http://oracletuningcorner.com/tag/gatherauto/

6/6

Вам также может понравиться