oracle內存命中率

內存優化(各子內存塊命中率計算) 

2009-11-15 19:39:24|  分類: OraDailySql |  標籤:內存命中率  |字號 訂閱

instance= memory + background process

memory= sga +pga

sga=shared_pool + db_buffer_cache+log_buffer

shared_pool=libary_cache+dictionary_cache

---A 數據緩衝區的命中率--- should be more than 90%
select 1 -
         sum(case when name like '%physical reads%' then value else 0 end) /
       (sum(case when name like  '%db block gets%' then value else 0 end ) +
       sum(case when name like '%consistent gets%' then value else 0 end))
        as hit_ratio
  from v$sysstat;
---B 共享池命中率---should be more than 60%
select s.used,p.VALUE sharedpool_usage_ratio  from (select sum(bytes) used from v$sgastat where pool ='shared pool' and name <>'free memory') s,v$parameter p where p.NAME='shared_pool_size';
-----------------1、共享池命中率(sql,pl/sql內存命中率,庫緩存命中率)
select ((sum(pinhits)/sum(pins))) pinhitratio,sum(reloads) misses ,((sum(pins)/(sum(pins)+sum(reloads)))) relhitratio from v$librarycache
-----------------2、數據字典命中率
select 1- sum(getmisses)/(sum(gets)+sum(getmisses)) hitratio from v$rowcache;
---C pga命中率
-----------------1、workarea_size_policy=auto
select * from v$pgastat where name like 'cache hit percentage';
-----------------2、workarea_size_policy=manul
select name,value from V$sysstat where name like '%sort%';
select * From v$sga;
select * from v$sgainfo;
select * from v$sga_dynamic_components;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章