[Oracle Script] Library Cche Hit Ratio
SELECT TO_CHAR(SYSDATE, 'yyyy/mm/dd hh24:mi:ss') TIME,
SUM(reloads) reloads, round(sum(reloads)/sum(pins),4)*100 "Library Cache Reload Ratio",
SUM(gets) gets, SUM(gethits) gethits, round(sum(gethits)/sum(gets),4)*100 "GetHit Ratio",
SUM(pins) pins,SUM(pinhits) pinhits , round(sum(pinhits)/sum(pins),4)*100 "PinHit Ratio"
FROM v$librarycache;
-----------------------------------------------------------------------------------------------------------------------------------
TIME RELOADS Library Cache Reload Ratio GETS GETHITS GetHit Ratio PINS PINHITS PinHit Ratio
2017/03/02 11:38:12 4050 0.01 8702998 8624844 99.1 47411158 47311059 99.79
GETS 可以理解為某個object解析的時候查詢的次數(解析階段)
GETHITS get命中次數
GETHITRATIO 這個值等於gethits/gets
PINS 某個object 解析過後被執行的次數(發生在執行階段)
PINHITS pin命中次數
PINHITRATIO 這個值等於pinhits/pins
RELOADS 某個object 解析過後被從新載入的次數(需要從新從磁碟讀取object),也就是沒有被快取到library cache中,這個通常由於shared pool 過小
INVALIDATIONS 某個物件無效,通常由於物件定義被更改,需要從新解析
select sum(sharable_mem) from v$db_object_cache; #檢視當前shared pool使用的大小
------------------------------------------------
SUM(SHARABLE_MEM)
406164568
select * from v$sgastat where name='free memory' and pool='shared pool'; #檢視當前剩餘shared pool的大小
-----------------------------------------------------------------------
POOL NAME BYTES
shared pool free memory 511748680
長期執行的資料庫的 library cache hitratio 最好應該在95%以上,sum(reloads)與sum(pins) 的比值應該小於 1%,
如果pinhitratio 小於90%,或者reload ratio 大於1% ,而且shared pool 的free memory 很小或者為0,
那麼可以適當增加shared_pool的大小,檢查應用程式程式碼效率,比如是否使用了繫結變數等等.
當前pinhit ratio 99.79,reloads ratio 0.01, free memory 500多M,夠用.
SUM(reloads) reloads, round(sum(reloads)/sum(pins),4)*100 "Library Cache Reload Ratio",
SUM(gets) gets, SUM(gethits) gethits, round(sum(gethits)/sum(gets),4)*100 "GetHit Ratio",
SUM(pins) pins,SUM(pinhits) pinhits , round(sum(pinhits)/sum(pins),4)*100 "PinHit Ratio"
FROM v$librarycache;
-----------------------------------------------------------------------------------------------------------------------------------
TIME RELOADS Library Cache Reload Ratio GETS GETHITS GetHit Ratio PINS PINHITS PinHit Ratio
2017/03/02 11:38:12 4050 0.01 8702998 8624844 99.1 47411158 47311059 99.79
GETS 可以理解為某個object解析的時候查詢的次數(解析階段)
GETHITS get命中次數
GETHITRATIO 這個值等於gethits/gets
PINS 某個object 解析過後被執行的次數(發生在執行階段)
PINHITS pin命中次數
PINHITRATIO 這個值等於pinhits/pins
RELOADS 某個object 解析過後被從新載入的次數(需要從新從磁碟讀取object),也就是沒有被快取到library cache中,這個通常由於shared pool 過小
INVALIDATIONS 某個物件無效,通常由於物件定義被更改,需要從新解析
select sum(sharable_mem) from v$db_object_cache; #檢視當前shared pool使用的大小
------------------------------------------------
SUM(SHARABLE_MEM)
406164568
select * from v$sgastat where name='free memory' and pool='shared pool'; #檢視當前剩餘shared pool的大小
-----------------------------------------------------------------------
POOL NAME BYTES
shared pool free memory 511748680
長期執行的資料庫的 library cache hitratio 最好應該在95%以上,sum(reloads)與sum(pins) 的比值應該小於 1%,
如果pinhitratio 小於90%,或者reload ratio 大於1% ,而且shared pool 的free memory 很小或者為0,
那麼可以適當增加shared_pool的大小,檢查應用程式程式碼效率,比如是否使用了繫結變數等等.
當前pinhit ratio 99.79,reloads ratio 0.01, free memory 500多M,夠用.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-2143823/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [Oracle Script] Buffer Cache Hit RatioOracle
- Hit Ratio For ORACLEOracle
- Keeping the Library Cache Reload Ratio at 0 and the Hit Ratio Above 95 Percent
- Buffer Cache Hit Ratio
- why Buffer Cache Hit Ratio < 0
- Cursor Cache Hit Ratio超過100%
- Keeping the Data Dictionary Cache Hit Ratio at or above 95 Percent
- Library Hit %: -986.64 負數的問題
- oracle scriptOracle
- statspack中Library Hit是如何計算的?
- [Oracle Script] LockOracle
- Oracle Database ScriptOracleDatabase
- Oracle ArchitectureOracle
- oracle分析函式之ratio_to_reportOracle函式
- [Oracle Script] Top sqlOracleSQL
- [Oracle Script] check userOracle
- [Oracle Script] check latchOracle
- Oracle kill session scriptOracleSession
- ORACLE常用Script(轉)Oracle
- ORACLE常用Script (轉)Oracle
- Oracle Reporting 1 - Ratio_to_Report FunctionOracleFunction
- Oracle Library cacheOracle
- [Oracle Script] check active sessionOracleSession
- [Oracle Script] Log switch statusOracle
- [Oracle Script] check lock infoOracle
- [Oracle Script] latch holderOracle
- [Oracle Script] Temporary Sort UsageOracle
- [Oracle Script] Rollback Segment UsageOracle
- [Oracle Script] check Literal SQLOracleSQL
- Oracle TOP SQL&&HITOracleSQL
- Oracle - Hit/Miss RatiosOracleiOS
- tahiti.oracle.comOracle
- Oracle Database Documentation LibraryOracleDatabase
- [Oracle Script] check tablespace usage infoOracle
- [Oracle Script] select db parameterOracle
- [Oracle Script] check temp tablespace usageOracle
- [Oracle Script] ASM Disks Performance metricOracleASMORM
- [Oracle Script] Undo Usage Per statusOracle