----未亲测---
sql server 2000 可以通过dbcc sqlperf(lrustats) 查询缓存命中率
2005版本 sys.dm_os_performance_counters
oracle
-- 数据缓冲区高速缓存
SELECT physical_reads, db_block_gets, consistent_gets, NAME,
100 * ( 1 - ( physical_reads / (consistent_gets + db_block_gets - physical_reads))) "Data Buffer Hit Ratio"
FROM v$buffer_pool_statistics;
-- 重做日至缓冲区
SELECT a.VALUE redo_entries, b.VALUE redo_buffer_allocation_retries,
ROUND ((1 - b.VALUE / a.VALUE) * 100, 4) log_buffer_ratio
FROM v$sysstat a, v$sysstat b
WHERE a.NAME = 'redo entries' AND b.NAME = 'redo buffer allocation retries';
-- 数据字典高速缓存
SELECT SUM (pinhits) / SUM (pins) * 100 "hit radio"
FROM v$librarycache;
-- 库高速缓存
SELECT TO_CHAR (ROUND ((1 - SUM (getmisses) / SUM (gets)) * 100, 1)) || '%' "Dictionary Cache Hit Ratio"
FROM v$rowcache;
-- 排序
SELECT a.VALUE disk_sort, b.VALUE memory_sort, ROUND ((1 - a.VALUE / (a.VALUE + b.VALUE)) * 100, 4) sort_ratio
FROM v$sysstat a, v$sysstat b
WHERE a.NAME = 'sorts (disk)' AND b.NAME = 'sorts (memory)'; |