




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
TuningtheSharedPoolObjectivesAftercompletingthislesson,youshouldbeabletodothefollowing:DiagnosesharedpoolproblemsSizethesharedpoolSizethereservedareaKeepobjectsinthesharedpoolSharedPoolArchitectureMajorcomponentsofthesharedpoolare:LibrarycacheDatadictionarycacheUserglobalarea(UGA)forsharedserversessionsDatabasebuffercacheRedologbuffer
SharedpoolLibrarycacheDatadictionarycache
SharedareasLargepool
UGASharedPoolOperationThesharedpoolismanagedbyanLRUalgorithm.Newobjectsrequirememoryallocations.Re-creatableobjectsareagedoutofthecache.Objectsaremadeupofchunksofmemory.Amemoryallocationisawholechunk.Achunkiscontiguous.TheLibraryCacheStorescomplexobjectmetadataassociatedwithcursorsStoresSQLstatementsandPL/SQLblocksthataretobesharedbyusersPreventsstatementreparsingSQLAREASQLandPL/SQLStorageCursorcontextareafor
SELECTstatement2Cursorcontextareafor
SELECTstatement1SharedpoolSELECTstatement2SELECTstatement1SELECTstatement1CursorUsageandParsingParseprocedure:1. Findandexecuteanopencursor.2. Findaclosedcursorinthesessioncache.3. Searchthehashchains(softparse).4. Constructthecursor(hardparse).OpencursorsClosedcursorsSessionmemory(UGA)Sharedpool(SGA)CursorhandlesHashchains1234ImportantSharedPoolLatcheslatch:sharedpoolprotectsmemoryallocationsinthesharedpool.latch:librarycachelocatesmatchingSQLinthesharedpool.MutexAmutualexclusionobjectallows:SharingofaresourcewithoutcorruptionSharedaccessforreadsExclusiveaccessforupdateEachobjecttohaveitsownmutexBenefitsofMutexPerformanceisimprovedwithmutexes.Mutexes:AresmallerandfasterHavelesspotentialforcontentionReplacelatchesandpinsMutexViewsandStatisticsMutexviews:V$MUTEX_SLEEPV$MUTEX_SLEEP_HISTORYMutexwaitevents:cursor:mutexXcursor:mutexScursor:pinXcursor:pinScursor:pinSwaitonXMutex-ProtectedOperationsFromonward,mutexprotects:SelectsfromV$SQLSTATSearchesofchildcursorlistsStatspack/AWRIndicatorsStatspackandAWRreportsincludeindicators:LoadProfileInstanceEfficienciesTopWaitEventsTimeModelLoadProfileLoadProfilePerSecondPerTransaction~~~~~~~~~~~~------------------------------Usercalls:4.2921.78Parses:188.09954.20Hardparses:80.00405.85%BlockschangedperRead:0.18RecursiveCall%:99.78Rollbackpertransaction%:9.76RowsperSort:8.47InstanceEfficienciesInstanceEfficiencyPercentages~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~BufferNowait%:100.00RedoNoWait%:100.00BufferHit%:99.87In-memorySort%:100.00LibraryHit%:87.90SoftParse%:57.47ExecutetoParse%:22.50LatchHit%:100.00ParseCPUtoParseElapsd%:83.16%Non-ParseCPU:17.88SharedPoolStatisticsBeginEnd------------MemoryUsage%:92.7592.97%SQLwithexecutions>1:72.6272.28%MemoryforSQLw/exec>1:92.3592.17TopWaitsTop5TimedEventsAvg%Total~~~~~~~~~~~~~~~~~~waitCallEventWaitsTime(s)(ms)Time----------------------------------------------------CPUtime19098.0latch:librarycache76119.8latch:sharedpool49116.4dbfilesequentialread1,34300.2logfileparallelwrite5405.1-------------------------------------------------------TimeModelTimeModelSystemStats->Orderedby%ofDBtimedesc,Statisticname %ofStatisticTime(s)DBtime------------------------------------------------------sqlexecuteelapsedtime399.595.6DBCPU269.364.4parsetimeelapsed126.830.3hardparseelapsedtime111.926.8PL/SQLcompilationelapsedtime6.61.6PL/SQLexecutionelapsedtime5.91.4connectionmanagementcallelapsed4.91.2failedparseelapsedtime4.01.0hardparse(sharingcriteria)elaps2.3.5sequenceloadelapsedtime0.5.1hardparse(bindmismatch)elapsed0.2.0repeatedbindelapsedtime0.1.0DBtime417.9LibraryCacheActivityLibraryCacheActivityDB/Inst:ORCL/orclSnaps:61-71->"PctMisses"shouldbeverylowGetPctPinPctInvali-NamespaceRequestsMissRequestsMissReloadsdations-----------------------------------------------------------BODY3327.345014.0460CLUSTER490.02003.060INDEX5100.035,3000.000SQLAREA18,88096.989,90436.54960TerminologyGets:(Parse)Thenumberoflookupsforobjects
ofthenamespacePins:(Execution)ThenumberofreadsorexecutionsoftheobjectsofthenamespaceReloads:(Parse)Thenumberoflibrarycachemissesontheexecutionstep,therebycausinganimplicitreparsingoftheSQLstatementInvalidations:ThenumberoftimesanobjectismodifiedbyaDDL,causingalldependentobjectstobemarkedinvalidV$SGASTATV$SGAINFOV$LIBRARYCACHEV$LIBRARY_CACHE_MEMORYV$SHARED_POOL_RESERVEDV$SQLSTATSV$SQLV$SQLAREAV$SQLTEXTV$DB_OBJECT_CACHEDiagnosticTools
forTuningtheSharedPoolParametersaffectingthecomponents:SHARED_POOL_SIZE,OPEN_CURSORSSESSION_CACHED_CURSORS,CURSOR_SPACE_FOR_TIMECURSOR_SHARING,SHARED_POOL_RESERVED_SIZEsp_m_n.lstreport.txtDatadictionary
cacheSharedpoolLibrarycacheSharedSQLandPL/SQLViewsLibraryCacheReloadsReloadsshouldbelessthan1%ofthepins:Ifthereloads-to-pinsratioisgreaterthan1%,increasethevalueoftheSHARED_POOL_SIZEparameter.SQL>SELECTSUM(pins)"Executions", 2SUM(reloads)"CacheMisses",3SUM(reloads)/SUM(pins)4FROMV$LIBRARYCACHE;ExecutesPROC1—>1stpin,1loadExecutesPROC1
—>2ndpin,noreloadExecutesPROC1
—>3rdpin,noreloadExecutesPROC1
—>4thpin,noreloadFourpinsandnoreloadsInvalidationsThenumberoftimesobjectsofthenamespacewere
markedinvalid,causingreloads:SQL>SELECTCOUNT(*)FROMhr.employees;SQL>SELECTnamespace,pins,reloads,2invalidations3FROMV$LIBRARYCACHE;SQL>executeDBMS_STATS.GATHER_TABLE_STATS->('HR','EMPLOYEES');SQL>SELECTCOUNT(*)FROMhr.employees;SQL>SELECTnamespace,pins,reloads,2invalidations3FROMV$LIBRARYCACHE;AvoidHardParsesInanOLTPsystem,reducemissesbykeepinghardparsingtoaminimum:Makesurethatuserscansharestatements.Preventfrequentlyusedstatementsfrombeingagedoutbyallocatingenoughspace.Avoidinvalidationsthatinducereparsing.AreCursorsBeingShared?CheckGETHITRATIOinV$LIBRARYCACHE:Determinewhichstatementscouldbeshared:SQL>SELECTplan_hash_value,count(*)2FROMV$SQL3GROUPBYplan_hash_valueORDERBY2DESCSQL>SELECTsql_text,executions2FROMV$SQLAREA3WHEREplan_hash_value=NNNNNNNNNSQL>SELECTgethitratio2FROMV$LIBRARYCACHE3WHEREnamespace='SQLAREA';SharingCursorsValuesforCURSOR_SHARINGare:EXACTSIMILARFORCEAvoidingSoftParsesReducingsoftparsesreduceslibrarycachelatchcontention.Keepsoftparsingtoaminimumby:SettingSESSION_CACHED_CURSORSSettingHOLD_CURSORintheapplicationprecompilerSettingCURSOR_SPACE_FOR_TIMEAvoidingFragmentationAvoidfragmentationby:Upgradingto10.2.0.xKeepingfrequentlyrequiredlargeobjectsReservingspaceforlargeobjectsEliminatinglargeanonymousPL/SQLblocksEnablingtheuseoflargepoolSizingtheSharedPoolUseAutomaticSharedMemoryManagement.UsetheSharedPoolAdvisorandconfirmusingotherdiagnosticswhendatahasoperationalhistory.Use40percentoftheSGAsizetostart,whenthereisnohistory.Monitorandadjustasneeded.Donotincreasethesizewhenfreememoryisavailable.SQL>SELECT*FROMV$SGASTAT2WHERENAME='freememory'3ANDPOOL='sharedpool';SharedPoolAdvisorySQL>SELECTshared_pool_size_for_estimateAS2pool_size,estd_lc_size,3estd_lc_time_saved4FROMV$SHARED_POOL_ADVICE;POOL_SIZEESTD_LC_SIZEESTD_LC_TIME_SAVED----------------------------------------328786840157868481778685617786864177868721778688017786888177868SharedPoolAdvisorLargeMemoryRequirementsSatisfyrequestsforlargecontiguousmemory.Reservecontiguousmemorywithinthe
sharedpool.SHARED_POOL_SIZESHARED_POOL_RESERVED_SIZEDatadictionary
cacheSharedpoolLibrarycacheSharedSQLandPL/SQLV$SHARED_POOL_RESERVEDReservedareaTuningtheSharedPool
ReservedSpaceIFREQUEST_FAILURESAction>0andincreasingANDRequest_misses>0IncreaseSHARED_POOL_
RESERVED_SIZE>0andincreasingANDFree_memory=>50%ofSHARED_POOL_RESERVED_SIZEIncreaseSHARED_POOL_
SIZE=0ORFree_memory=>50%ofSHARED_POOL_RESERVED_SIZEDecreaseSHARED_POOL_
RESERVED_SIZEKeepingLargeObjectsFindthosePL/SQLobjectsthatarenotkeptinthelibrarycache:Pinlargepackagesinthelibrarycache:SQL>EXECUTEDBMS_SHARED_POOL.KEEP(‘package_name’);
SQL>SELECT*FROMV$DB_OBJECT_CACHE2WHEREsharable_mem>100003AND(type='PACKAGE'ORtype='PACKAGEBODY'OR4type='FUNCTION'ORtype='PROCEDURE')5ANDkept='NO';DataDictionaryCacheThedatadictionarycacheholdsrowimagesofdatadictionaryrows.Datadictionarycache
DatadictionaryStatspack/AWRreportoutput:Iftherearetoomanycachemisses,increasetheSHARED_POOL_SIZEparameter.DictionaryCacheMisses
GetPctFinalCacheRequestsMissUsage-------------------------------------dc_histogram_data5,58726.8411dc_histogram_defs92,5013.7899dc_object_grants24055.026dc_object_ids959,2930.1289dc_objects19,3855.7314UGAandOracleSharedServerSharedpoolPGASharedpool
or
LargepoolStackspacePGAStackspaceUsersessiondataCursorstateUGA
V$STATNAME
V$SESSTAT
V$MYSTATOPEN_CURSORSSESSION_CACHED_CURSORSC
溫馨提示
- 1. 本站所有資源如無(wú)特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 社交媒體內(nèi)容運(yùn)營(yíng)與用戶互動(dòng)策略
- 會(huì)展產(chǎn)品合同范本
- 2025至2030年中國(guó)節(jié)能環(huán)保鋁合金門窗數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 二零二五年度服裝零售加盟店經(jīng)營(yíng)合同樣本
- 電子競(jìng)技在醫(yī)療領(lǐng)域的應(yīng)用心理與身體健康
- 2025至2030年中國(guó)肛腸綜合治療儀數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025年度通信行業(yè)競(jìng)業(yè)禁止補(bǔ)償金及違約責(zé)任合同
- 二零二五年度股東利益共享與公司可持續(xù)發(fā)展協(xié)議
- 2025年度生物醫(yī)藥產(chǎn)業(yè)招商引資合同書
- 二零二五年度企業(yè)內(nèi)部審計(jì)咨詢顧問服務(wù)協(xié)議
- 自我解壓與情緒管理課件
- 2024年時(shí)政必考試題庫(kù)ab卷
- 2024年湖南環(huán)境生物職業(yè)技術(shù)學(xué)院?jiǎn)握新殬I(yè)適應(yīng)性測(cè)試題庫(kù)及參考答案
- 專題06 壓強(qiáng)計(jì)算(壓強(qiáng)與浮力結(jié)合題)-上海市2024年中考復(fù)習(xí)資料匯編(培優(yōu)專用)【解析版】
- 語(yǔ)法選擇10篇(名校模擬)-2024年中考英語(yǔ)逆襲沖刺名校模擬真題速遞(廣州專用)
- 2024年輔警招聘考試試題庫(kù)含完整答案(各地真題)
- MOOC 中國(guó)文化概論-武漢大學(xué) 中國(guó)大學(xué)慕課答案
- 高三心理健康輔導(dǎo)講座省公開課一等獎(jiǎng)全國(guó)示范課微課金獎(jiǎng)
- 《工程建設(shè)標(biāo)準(zhǔn)強(qiáng)制性條文電力工程部分2023年版》
- 壺口瀑布公開課省公開課一等獎(jiǎng)全國(guó)示范課微課金獎(jiǎng)?wù)n件
- 航天禁(限)用工藝目錄(2021版)-發(fā)文稿(公開)
評(píng)論
0/150
提交評(píng)論