ãã说å¨åé¢ï¼å¾å®¹æ被忽ç¥çå 个ç¹ï¼å¨è¯»æ¥åçæ¶åï¼æ们é¦å
éè¦çæ¸
æ¥ï¼çæ3个å
容ï¼è¿ä»½æ¥åæ对åºçæ°æ®åºçæ¬ï¼clusteræ¹å¼ï¼ä»¥åæ¥åçæ¶é´æ®µãå°¤å
¶éè¦æ³¨æçå°±æ¯æ¶é´æ®µï¼è±ç¦»äºæ¶é´æ®µçstatspckå°æ¯æ¯«æ æä¹çï¼çè³ä¼å¾åºé误çç»æã STATSPACK report for
ãã1ãæ¥è¡¨å¤´ä¿¡æ¯
ãã
ãã/* æ¥è¡¨å¤´ä¿¡æ¯ï¼æ°æ®åºå®ä¾ç¸å
³ä¿¡æ¯ï¼å
æ¬æ°æ®åºå称ãIDãçæ¬å·å主æºæçä¿¡æ¯ã å¦å¤ï¼éç¹è¿éè¦å
³æ³¨ä¸ä¸æ¥å产ççæ¶é´è·¨åº¦, 以å并åæ°.
ãã
ãã2ãå®ä¾è´è½½æ¡£ä¿¡æ¯
ãã
ããä¸é¢è¯¦ç»è¯´æLoad Profileå项å«ä¹
ããRedo size:æ¯ç§äº§ççæ¥å¿å¤§å°(åä½åè)ï¼å¯æ å¿æ°æ®åæ´é¢ç, æ°æ®åºä»»å¡çç¹éä¸å¦ãé常å¨å¾ç¹å¿çç³»ç»ä¸æ¥å¿çæéå¯è½è¾¾å°ä¸ç¾kï¼çè³å ç¾k
ããLogical reads:å¹³å³æ¯ç§äº§ççé»è¾è¯»çblockæ°ãLogical Reads= Consistent Gets + DB Block Gets, blockå¨å
åä¸ï¼æ们æ¯ä¸æ¬¡è¯»ä¸åå
åï¼å°±ç¸å½äºä¸æ¬¡é»è¾è¯»
ããBlock changes:æ¯ç§blockååæ°éï¼æ°æ®åºäºç©å¸¦æ¥æ¹åçåæ°éã
ããPhysical reads:å¹³åæ¯ç§æ°æ®åºä»ç£ç读åçblockæ°ã
ããPhysical writes:å¹³åæ¯ç§æ°æ®åºåç£ççblockæ°ã
ããUser calls:æ¯ç§ç¨æ·è°ç¨æ¬¡æ°ã
ããParses:æ¯ç§è§£æ次æ°ï¼å
æ¬fast parseï¼soft parseåhard parseä¸ç§æ°éç综åã软解ææ¯ç§è¶
è¿300次æå³çä½ ç"åºç¨ç¨åº"æçä¸é«ï¼è°æ´session_cursor_cacheãå¨è¿éï¼fast parseæçæ¯ç´æ¥å¨PGAä¸å½ä¸çæ
åµï¼è®¾ç½®äºsession_cached_cursors=nï¼ï¼soft parseæ¯æå¨shared poolä¸å½ä¸çæ
å½¢ï¼hard parseåæ¯æé½ä¸å½ä¸çæ
åµã Hard parses:æ¯ç§äº§çç硬解æ次æ°, æ¯ç§è¶
è¿100次ï¼å°±å¯è½è¯´æä½ ç»å®ä½¿ç¨çä¸å¥½ï¼ä¹å¯è½æ¯å
±äº«æ± 设置ä¸åçãè¿æ¶åå¯ä»¥å¯ç¨åæ°cursor_sharing=similar|forceï¼è¯¥åæ°é»è®¤å¼ä¸ºexactãä½è¯¥åæ°è®¾ç½®ä¸ºsimilaræ¶ï¼åå¨bugï¼å¯è½å¯¼è´æ§è¡è®¡åçä¸ä¼ã 80%çç³»ç»çæ
¢é½æ¯ç±äºè¿ä¸ªåå æ导è´ç, èhard parseçæ ¹æºï¼åºæ¬é½æ¯ç±äºä¸ä½¿ç¨bind varæ导è´ç, è¿æå°±æ¯ä¸ºäºç»´æ¤internal structureï¼éè¦ä½¿ç¨latchï¼latchæ¯ä¸ç§Oracleä½çº§ç»æ,ç¨äºä¿æ¤å
åèµæºï¼æ¯ä¸ç§å
é¨çå½å¨æå¾ççlockï¼å¤§é使ç¨latchå°æ¶è大éçcpuèµæºã
ããSorts:æ¯ç§äº§ççæåºæ¬¡æ°ã
ããLogons:æ¯ç§ç»éç次æ°ã
ããExecutes:æ¯ç§æ§è¡æ¬¡æ°ã
ããTransactions:æ¯ç§äº§ççäºå¡æ°ï¼åæ æ°æ®åºä»»å¡ç¹éä¸å¦ã
ããBlocks changed per Read: 13.28 %
ããRecursive Call %: 80.21
ããRollback per transaction %: 0.03
ãã说æå¦ä¸:
ãã
ãã1) Blocks changed per Readï¼å¨æ¯ä¸æ¬¡é»è¾è¯»ä¸æ´æ¹çåçç¾åæ¯ã
ãã2) Rollback per transaction %:çåæ»çæ¯ä¸æ¯å¾é«ï¼å 为åæ»å¾èèµæº ,å¦æåæ»çè¿é«,å¯è½è¯´æä½ çæ°æ®åºç»åäºå¤ªå¤çæ ææä½ ,è¿å¤çåæ»å¯è½è¿ä¼å¸¦æ¥Undo Blockçç«äº 该åæ°è®¡ç®å
¬å¼å¦ä¸: Round(User rollbacks / (user commits + user rollbacks) ,4)* 100% ãé常åºè¯¥å°äº10%为好
ãã3) Recursive Call %:éå½è°ç¨çç¾åæ¯ï¼å¦ææå¾å¤PL/SQLï¼é£ä¹è¿ä¸ªå¼å°±ä¼æ¯è¾é«ã
ãã4) Rows per Sort:å¹³åæ¯æ¬¡æåºæä½çè¡æ°ã
ãã3ãå®ä¾æææ§ä¿¡æ¯
ãã
ããå®ä¾çæææ§ï¼è¿é¨åå¼è¶æ¥è¿100è¶å¥½ï¼å项å
容详ç»è¯´æå¦ä¸ï¼
ãã1) Buffer Nowait %ï¼å¨ç¼å²åºä¸è·åBufferçæªçå¾
æ¯çãBuffer Nowaitçè¿ä¸ªå¼ä¸è¬éè¦å¤§äº99%ãå¦åå¯è½åå¨äºç¨ï¼å¯ä»¥å¨åé¢ççå¾
äºä»¶ä¸è¿ä¸æ¥ç¡®è®¤ã
ãã2) Redo NoWait %ï¼å¨Redoç¼å²åºè·åBuffer空é´çæªçå¾
æ¯çãå½redo bufferè¾¾å°1Mæ¶ï¼å°±éè¦åå°redo logæ件ï¼æ以ä¸è¬å½redo buffer设置è¶
è¿1Mï¼ä¸å¤ªå¯è½åå¨çå¾
buffer空é´åé
çæ
åµãå½åï¼ä¸è¬è®¾ç½®ä¸º2Mçredo bufferï¼å¯¹äºå
åæ»éæ¥è¯´ï¼åºè¯¥ä¸æ¯ä¸ä¸ªå¤ªå¤§çå¼ã
ãã3) Buffer Hit %ï¼æ°æ®åå¨æ°æ®ç¼å²åºä¸çå½ä¸çï¼é常åºå¨95%以ä¸ãå¦åï¼å°äº95%ï¼éè¦è°æ´éè¦çåæ°ï¼å°äº90%å¯è½æ¯è¦å db_cache_sizeãä¸ä¸ªé«çå½ä¸çï¼ä¸ä¸å®ä»£è¡¨è¿ä¸ªç³»ç»çæ§è½æ¯æä¼çï¼æ¯å¦å¤§éçééæ©æ§çç´¢å¼è¢«é¢ç¹è®¿é®ï¼å°±ä¼é æå½ä¸çå¾é«çåç¸ï¼å¤§éçdb file sequential readï¼ï¼ä½æ¯ä¸ä¸ªæ¯è¾ä½çå½ä¸çï¼ä¸è¬å°±ä¼å¯¹è¿ä¸ªç³»ç»çæ§è½äº§çå½±åï¼éè¦è°æ´ãå½ä¸çççªåï¼å¾å¾æ¯ä¸ä¸ªä¸å¥½çä¿¡æ¯ãå¦æå½ä¸ççªç¶å¢å¤§ï¼å¯ä»¥æ£æ¥top buffer get SQLï¼æ¥ç导è´å¤§éé»è¾è¯»çè¯å¥åç´¢å¼ï¼å¦æå½ä¸ççªç¶åå°ï¼å¯ä»¥æ£æ¥top physical reads SQLï¼æ£æ¥äº§ç大éç©ç读çè¯å¥ï¼ä¸»è¦æ¯é£äºæ²¡æ使ç¨ç´¢å¼æè
ç´¢å¼è¢«å é¤çã
ãã4) In-memory Sort %ï¼å¨å
åä¸çæåºçãå¦æä½äº95%ï¼å¯ä»¥éè¿éå½è°å¤§åå§ååæ°PGA_AGGREGATE_TARGETæè
SORT_AREA_SIZEæ¥è§£å³ï¼æ³¨æè¿ä¸¤ä¸ªåæ°è®¾ç½®ä½ç¨çèå´æ¶ä¸åçï¼SORT_AREA_SIZEæ¯é对æ¯ä¸ªsession设置çï¼PGA_AGGREGATE_TARGETåæ¶é对ææçsesionçã
ãã5) Library Hit %ï¼STATEMENTå¨å
±äº«åºçå½ä¸çï¼é常åºè¯¥ä¿æå¨95%以ä¸ï¼å¦åéè¦è¦èèï¼å 大å
±äº«æ± ï¼ä½¿ç¨ç»å®åéï¼ä¿®æ¹cursor_sharingçåæ°ã
ãã6) Soft Parse %ï¼sqlå¨å
±äº«åºçå½ä¸çï¼å°äº<95%,éè¦èèç»å®ï¼å¦æä½äº80%ï¼é£ä¹å°±å¯ä»¥è®¤ä¸ºsqlåºæ¬æ²¡æ被éç¨ã
ãã7) Execute to Parse %ï¼ä¸ä¸ªè¯å¥æ§è¡ååæäºå¤å°æ¬¡ç度éãè¿ä¸ªæ°åä¹åºè¯¥æ¯è¶å¤§è¶å¥½ï¼æ¥è¿100%æ好, æ¬ä¾ä¸ï¼å·®ä¸å¤æ¯execution 5次éè¦ä¸æ¬¡parseãæ以å¦æç³»ç»Parses > Executionsï¼å°±å¯è½åºç°è¯¥æ¯çå°äº0çæ
åµã该å¼<0é常说æshared pool设置æè
è¯å¥æçåå¨é®é¢ï¼é æåå¤è§£æï¼reparseå¯è½è¾ä¸¥é,æè
æ¯å¯è½åsnapshotæå
³ï¼é常说ææ°æ®åºæ§è½åå¨é®é¢ã
ãã8) Latch Hit %ï¼è¦ç¡®ä¿>99%ï¼å¦ååå¨ä¸¥éçæ§è½é®é¢ãå½è¯¥å¼åºç°é®é¢çæ¶åï¼æ们å¯ä»¥åå©åé¢ççå¾
æ¶é´ålatchåææ¥æ¥æ¾è§£å³é®é¢ã
ãã9) Parse CPU to Parse Elapsd %ï¼è®¡ç®å
¬å¼ä¸ºï¼Parse CPU to Parse Elapsd %= 100*(parse time cpu / parse time elapsed)ãå³ï¼è§£æå®é
è¿è¡æ¶é´/(解æå®é
è¿è¡æ¶é´+解æä¸çå¾
èµæºæ¶é´)ãå¦æ该æ¯ç为100%ï¼æå³çCPUçå¾
æ¶é´ä¸º0ï¼æ²¡æä»»ä½çå¾
ã
ãã10) % Non-Parse CPUï¼è®¡ç®å
¬å¼ä¸ºï¼% Non-Parse CPU =round(100*1-PARSE_CPU/TOT_CPU),2)ãå¦æè¿ä¸ªå¼æ¯è¾å°ï¼è¡¨ç¤ºè§£ææ¶èçCPUæ¶é´è¿å¤ãä¸PARSE_CPUç¸æ¯ï¼å¦æTOT_CPUå¾é«ï¼è¿ä¸ªæ¯å¼å°æ¥è¿100%ï¼è¿æ¯å¾å¥½çï¼è¯´æ计ç®æºæ§è¡ç大é¨åå·¥ä½æ¯æ§è¡æ¥è¯¢çå·¥ä½ï¼èä¸æ¯åææ¥è¯¢çå·¥ä½ã
ãã(ä¸å¾ä¸çä¸åé¨å)
ãã
ãã1) Memory Usage %ï¼æ£å¨ä½¿ç¨çå
±äº«æ± çç¾åçãè¿ä¸ªæ°ååºè¯¥é¿æ¶é´ç¨³å®å¨75%ï½90%ãå¦æè¿ä¸ªç¾åæ¯å¤ªä½ï¼è¡¨æå
±äº«æ± 设置è¿å¤§ï¼å¸¦æ¥é¢å¤ç管çä¸çè´æ
ï¼ä»èå¨æäºæ¡ä»¶ä¸ä¼å¯¼è´æ§è½çä¸éãå¦æè¿ä¸ªç¾åç太é«ï¼ä¼ä½¿å
±äº«æ± å¤é¨çç»ä»¶èåï¼å¦æSQLè¯å¥è¢«å次æ§è¡ï¼è¿å°ä½¿å¾SQLè¯å¥è¢«ç¡¬è§£æãå¨ä¸ä¸ªå¤§å°åéçç³»ç»ä¸ï¼å
±äº«æ± ç使ç¨çå°å¤äº75%å°ç¥ä½äº90%çèå´å
ã
ãã2) % SQL with executions>1ï¼è¿æ¯å¨å
±äº«æ± ä¸æå¤å°ä¸ªæ§è¡æ¬¡æ°å¤§äºä¸æ¬¡çSQLè¯å¥ç度éãä¹åºè¯¥å¤§ä¸ºå¥½ï¼å°å表示å¾å¤sqlåªè¢«æ§è¡äºä¸æ¬¡ï¼è¯´æ没æ使ç¨ç»å®åé, å¨ä¸ä¸ªè¶åäºå¾ªç¯è¿è¡çç³»ç»ä¸ï¼å¿
须认çèèè¿ä¸ªæ°åãå¨è¿ä¸ªå¾ªç¯ç³»ç»ä¸ï¼å¨ä¸å¤©ä¸ç¸å¯¹äºå¦ä¸é¨åæ¶é´çé¨åæ¶é´éæ§è¡äºä¸ç»ä¸åçSQLè¯å¥ãå¨å
±äº«æ± ä¸ï¼å¨è§å¯æé´å°æä¸ç»æªè¢«æ§è¡è¿çSQLè¯å¥ï¼è¿ä»
ä»
æ¯å 为è¦æ§è¡å®ä»¬çè¯å¥å¨è§å¯æé´æ²¡æè¿è¡ãåªæç³»ç»è¿ç»è¿è¡ç¸åçSQLè¯å¥ç»ï¼è¿ä¸ªæ°åæä¼æ¥è¿100%ãè¿éæ¾ç¤ºï¼å¨è¿ä¸ªå
±äº«æ± ä¸å ä¹æ80%çSQLè¯å¥å¨14åéçè§å¯çªå£ä¸è¿è¡æ¬¡æ°å¤äºä¸æ¬¡ãå©ä¸ç20%çè¯å¥å¯è½å·²ç»å¨é£éäº--ç³»ç»åªæ¯æ²¡æå»æ§è¡ã
ãã3) % Memory for SQL w/exec>1ï¼è¿æ¯ä¸ä¸é¢ç¹ä½¿ç¨çSQLè¯å¥ç¸æ¯ï¼é¢ç¹ä½¿ç¨çSQLè¯å¥æ¶èå
åå¤å°çä¸ä¸ªåº¦éãè¿ä¸ªæ°åå°å¨æ»ä½ä¸ä¸% SQL with executions>1é常æ¥è¿ï¼é¤éææäºæ¥è¯¢ä»»å¡æ¶èçå
å没æè§å¾ãå¨ç¨³å®ç¶æä¸ï¼æ»ä½ä¸ä¼çè§éçæ¶é´çæ¨ç§»å¤§çº¦æ75%ï½85%çå
±äº«æ± 被使ç¨ãå¦æStatspackæ¥è¡¨çæ¶é´çªå£è¶³å¤å¤§å°è¦çææçå¨æï¼æ§è¡æ¬¡æ°å¤§äºä¸æ¬¡çSQLè¯å¥çç¾åçåºè¯¥æ¥è¿äº100%ãè¿æ¯ä¸ä¸ªåè§å¯ä¹é´æç»æ¶é´å½±åçç»è®¡æ°åãå¯ä»¥ææå®éè§å¯ä¹é´çæ¶é´é¿åº¦å¢å¤§èå¢å¤§ã å°ç»ï¼éè¿ORACLEçå®ä¾æææ§ç»è®¡æ°æ®ï¼æ们å¯ä»¥è·å¾å¤§æ¦çä¸ä¸ªæ´ä½å°è±¡ï¼ç¶èæ们并ä¸è½ç±æ¤æ¥ç¡®å®æ°æ®è¿è¡çæ§è½ãå½åæ§è½é®é¢çç¡®å®ï¼æ们主è¦è¿æ¯ä¾é ä¸é¢ççå¾
äºä»¶æ¥ç¡®è®¤ãæ们å¯ä»¥è¿æ ·ç解两é¨åçå
容ï¼hitç»è®¡å¸®å©æ们åç°åé¢æµä¸äºç³»ç»å°è¦äº§ççæ§è½é®é¢ï¼ç±æ¤æ们å¯ä»¥åå°æªé¨ç»¸ç¼ªãèwaitäºä»¶ï¼å°±æ¯è¡¨æå½åæ°æ®åºå·²ç»åºç°äºæ§è½é®é¢éè¦è§£å³ï¼æ以æ¯äº¡ç¾è¡¥ç¢çæ§è´¨ã æ¥ä¸æ¥ï¼å¼å§æ¥çwaitäºä»¶ã
温馨提示:内容为网友见解,仅供参考