--查询Oracle数据库的软解析硬解析视图
SQL> select * from v$sysstat where name like ‘%parse%‘;
STATISTIC# NAME CLASS VALUE STAT_ID
---------- ------------------------------ ---------- ---------- ----------
264 ADG parselock X get attempts 1 0 564381705
265 ADG parselock X get successes 1 0 3808229129
622 parse time cpu 64 229 206905303
623 parse time elapsed 64 1376 1431595225
624 parse count (total) 64 8758 63887964
625 parse count (hard) 64 1457 143509059
626 parse count (failures) 64 7 1118776443
627 parse count (describe) 64 12 469016317
parse count hard 解析统计硬解析
parse count total 解析总数,包括硬解析、软解析
parse time cou 总CPU解析时间,单位10Ms,包括硬解析软解析
parse time elapsed完成解析调用总时间;
--查询,硬解析百分比:
select substr(a.value/b.value,1,4)*100||‘%‘ as "hard%" from (select value,class from v$sysstat where name like ‘%parse count (hard)%‘) a,(select value,class from v$sysstat where name like ‘%parse count (total)%‘) b where a.class=b.class;
--查询软解析百分比:
select substr((b.value-a.value)/b.value,1,4)*100||‘%‘ as "soft%" from (select value,class from v$sysstat where name like ‘%parse count (hard)%‘) a,(select value,class from v$sysstat where name like ‘%parse count (total)%‘) b where a.class=b.class;
--软解析:
with t as (select * from v$sysstat where name=‘parse count (total)‘),h as (select * from v$sysstat where name=‘parse count (hard)‘) select substr((t.value-h.value)/t.value,1,4)*100||‘%‘ as "soft%" from t,h;