V$ Monitor]
Counters=150
CustomCounters=12
;How many seconds for each data sample?
SamplingRate=10
[Custom0]
;Name must be unique
Name=库快存命中率
Description=该计数器返回当前库快存命中率
Query=SELECT 100*((sum(pins-reloads))/sum(pins)) from v$librarycache
IsRate=0
[Custom1]
;Name must be unique
Name=高速缓存区命中率
Description=oracle database shoot straight
Query=SELECT round(1-SUM(PHYSICAL_READS)/(SUM(DB_BLOCK_GETS) + SUM(CONSISTENT_GETS)), 4) * 100 FROM (SELECT CASE WHEN NAME='physical reads' THEN VALUE END PHYSICAL_READS,CASE WHEN NAME = 'db block gets' THEN VALUE END DB_BLOCK_GETS,CASE WHEN NAME = 'consistent gets' THEN VALUE END CONSISTENT_GETS FROM V$SYSSTAT WHERE Name IN ('physical reads','db block gets','consistent gets'))
IsRate=0
[Custom2]
;Name must be unique
Name=共享区库缓存区命中率
Description=命中率应大于0.99
Query=Select round(sum(pins-reloads)/sum(pins) * 100, 2) from v$librarycache
IsRate=0
[Custom3]
;Name must be unique
Name=共享区字典缓存区命中率
Description=命中率应大于0.85
Query=Select round(sum(gets-getmisses-usage-fixed)/sum(gets) * 100, 2) from v$rowcache
IsRate=0
[Custom4]
;Name must be unique
Name=检测回滚段的争用
Description=应该小于1%
Query=select round(sum(waits)/sum(gets) * 100, 2) from v$rollstat
IsRate=0
[Custom5]
;Name must be unique
Name=检测回滚段收缩次数
Description=应该小于1%
Query=select sum(shrinks) from v$rollstat, v$rollname where v$rollstat.usn = v$rollname.usn
IsRate=0
[Custom6]
;Name must be unique
Name=监控表空间的I/O读总数
Description=监控表空间的I/O
Query=select sum(f.phyrds) pyr from v$filestat f, dba_data_files df where f.file# = df.file_id
IsRate=0
[Custom7]
;Name must be unique
Name=监控表空间的I/O块读总数
Description=监控表空间的I/O
Query=select sum(f.phyblkrd) pbr from v$filestat f, dba_data_files df where f.file# = df.file_id
IsRate=0
[Custom8]
;Name must be unique
Name=监控表空间的I/O写总数
Description=监控表空间的I/O
Query=select sum(f.phywrts) pyw from v$filestat f, dba_data_files df where f.file# = df.file_id
IsRate=0
.
.
(以上为12个自定义的计数器,以下为LR工具自带的计数器)
[0]
Name=CPU used by this session
Description=This is the amount of CPU time (in 10s of milliseconds) used by a session between when a user call started and ended. Some user calls can complete within 10 milliseconds and as a result, the start and end user-call time can be the same. In this case, 0 milliseconds are added to the statistic. A similar problem can exist in the reporting by the operating system, especially on systems that suffer from many context switches.
IsRate=0
[1]
Name=CPU used when call started
Description=The CPU time used when the call is started.
IsRate=0
.
二、常用自定义计数器列表
序号 监控名称 SQL算法 说明
1、 数据高速缓存区命中率 SELECT round(1-SUM(PHYSICAL_READS)/(SUM(DB_BLOCK_GETS) + SUM(CONSISTENT_GETS)), 4) * 100 FROM (SELECT CASE WHEN NAME='physical reads' THEN VALUE END PHYSICAL_READS,CASE WHEN NAME = 'db block gets' THEN VALUE END DB_BLOCK_GETS,CASE WHEN NAME = 'consistent gets' THEN VALUE END CONSISTENT_GETS FROM V$SYSSTAT WHERE Name IN ('physical reads','db block gets','consistent gets')) (监控 SGA 的命中率)命中率应大于0.90最好
2、 库快存命中率 SELECT 100*((sum(pins-reloads))/sum(pins)) from v$librarycache 该计数器返回当前库快存命中率
5、 检测回滚段的争用 select round(sum(waits)/sum(gets) * 100, 2) from v$rollstat 小于1%
6、 检测回滚段收缩次数 select sum(shrinks) from v$rollstat, v$rollname where v$rollstat.usn = v$rollname.usn
7、 监控表空间的 I/O读总数 select sum(f.phyrds) pyr from v$filestat f, dba_data_files df where f.file# = df.file_id 监控表空间的 I/O
8、 监控表空间的 I/O块读总数 select sum(f.phyblkrd) pbr from v$filestat f, dba_data_files df where f.file# = df.file_id 监控表空间的 I/O
9、 监控表空间的 I/O写总数 select sum(f.phywrts) pyw from v$filestat f, dba_data_files df where f.file# = df.file_id 监控表空间的 I/O
10、 监控表空间的 I/O块写总数 select sum(f.phyblkwrt) pbw from v$filestat f, dba_data_files df where f.file# = df.file_id 监控表空间的 I/O
11、 监控 SGA 中重做日志缓存区的命中率 SELECT Decode(immediate_gets+immediate_misses,0,0,immediate_misses/(immediate_gets+immediate_misses)*100) ratio2 FROM v$latch WHERE name IN ('redo copy') 应该小于1%
12、 监控内存和硬盘的排序比率 select round(sum(case when name='sorts (disk)' then value else 0 end) / sum(case when name='sorts (memory)' then value else 0 end)*100,2) from (SELECT name, value FROM v$sysstatWHERE name IN ('sorts (memory)', 'sorts (disk)')) 最好使它小于 10%