1.2 共享池推薦大小:從v$shared_pool_advice中獲取,判斷條件是,若是shared增長10%,能夠減小2%左右的解析時間,取最大的一個點。Sql語句見下表 sql
select max(shared_pool_size_for_estimate) from (select shared_pool_size_for_estimate, nvl((estd_lc_time_saved_factor - lag(estd_lc_time_saved_factor, 1) over(order by shared_pool_size_factor)), estd_lc_time_saved_factor - 1) * 100 as time_save_factor from v$shared_pool_advice where estd_lc_time_saved_factor > 1.005) where time_save_factor > 2
select round((sum(PINS) - sum(RELOADS)) / sum(PINS) * 100,2) Hit_Ratio from v$librarycache
select round(sum(decode(executions,1,0,1))/count(1)*100,2) from v$sqlarea
1.6 數據緩存推薦大小:從v$db_cache_advice獲取的DEFAULT cache的建議值。若是數據庫參數db_cache_advice是OFF,則該字段顯示爲OFF,不然判斷條件爲,若是buffer cache每增長10%的大小,能夠減小25%的物理讀時間,則進入候選隊列,取候選隊列中的最大值。Sql語句以下 數據庫
select max(size_for_estimate) from (select size_for_estimate, nvl((lag(estd_physical_read_factor, 1) over(order by size_factor) -estd_physical_read_factor ), 0) * 10 as time_save_factor from v$db_cache_advice where estd_physical_read_factor <= 1 and name = 'DEFAULT') where time_save_factor > 0.5
select round(((consistent_gets + db_block_gets) - physical_reads) / (consistent_gets + db_block_gets) * 100,2) "Hit Ratio%" from v\$buffer_pool_statistics where physical_reads > 0 and name = 'DEFAULT'
1.9 PGA推薦大小:從v$pga_target_advice視圖中獲取。重點講這個視圖的estd_pga_cache_hit_percentage是評估的pga命中率,計算公式BYTES_PROCESSED / (BYTES_PROCESSED + ESTD_EXTRA_BYTES_RW),這個值越大越好。ESTD_OVERALLOC_COUNT字段的值應該爲0,若是不爲0,說明PGA不足。 緩存
select min(pga_target_for_estimate / 1024 / 1024) from v$pga_target_advice where ( estd_pga_cache_hit_percentage, estd_overalloc_count) in (select max(estd_pga_cache_hit_percentage), min(estd_overalloc_count) from v$pga_target_advice)
SELECT ROUND(optimal_count / total_count * 100, 2) "optimal_pct", ROUND(onepass_count / total_count * 100, 2) "onepass_pct", ROUND(multipass_count / total_count * 100, 2) "multipass_pct" FROM (SELECT SUM(a.total_executions) total_count, SUM(a.optimal_executions) optimal_count, SUM(a.onepass_executions) onepass_count, SUM(a.multipasses_executions) multipass_count FROM v\$sql_workarea_histogram a WHERE a.total_executions <> 0)
1.12 m-pass比例: 使用multi-pass mode完成排序的比例。具體解析見1.10。 jsp
共享池推薦大小 | Library命中率 | 執行次數大於1的SQL佔比 | 數據緩存推薦大小 | Buffer命中率 | PGA推薦大小 | optimal比例 |
---|---|---|---|---|---|---|
有值 | <99 | <70 | 有值 | <80 | 有值 | <95 |
1.2 執行次數大於1的SQL佔比低於閥值:系列主管DBA應推進開發使用綁定變量。 性能
1.3 m-pass值太高: 系列主管DBA應根據數據庫的業務類型判斷是否合理,是否存在sql過量使用排序(不合理的hash join)。 優化