- 最后登录
- 2015-4-9
- 在线时间
- 114 小时
- 威望
- 334
- 金钱
- 9852
- 注册时间
- 2011-11-16
- 阅读权限
- 60
- 帖子
- 158
- 精华
- 0
- 积分
- 334
- UID
- 94
|
2#
发表于 2012-7-4 00:02:49
statspack中。 找spreport脚本, 再找到里面执行了@@sprepins ,在后面这个脚本中 搜索 ‘top’. 找到:
-- Top N Wait Events
col idle noprint;
col event format a41 heading 'Top &&top_n_events Timed Events|~~~~~~~~~~~~~~~~~~|Event' trunc;
col waits format 999,999,990 heading 'Waits';
col time format 99,999,990 heading 'Time (s)';
col pctwtt format 999.9 heading '%Total|Call|Time';
col avwait format 99990 heading 'Avg|wait|(ms)';
select event
, waits
, time
, avwait
, pctwtt
from (select event, waits, time, pctwtt, avwait
from (select e.event event
, e.total_waits - nvl(b.total_waits,0) waits
, (e.time_waited_micro - nvl(b.time_waited_micro,0))/1000000 time
, decode( (e.total_waits - nvl(b.total_waits, 0)), 0, to_number(NULL)
, ( (e.time_waited_micro - nvl(b.time_waited_micro,0)) / &&ustoms )
/ (e.total_waits - nvl(b.total_waits,0))
) avwait
, decode(:tct_us, 0, 0, 100 * (e.time_waited_micro - nvl(b.time_waited_micro,0)) / (:tct_us)
) pctwtt
from stats$system_event b
, stats$system_event e
where b.snap_id(+) = :bid
and e.snap_id = :eid
and b.dbid(+) = :dbid
and e.dbid = :dbid
and b.instance_number(+) = :inst_num
and e.instance_number = :inst_num
and b.event(+) = e.event
and e.total_waits > nvl(b.total_waits,0)
and e.event not in (select event from stats$idle_event)
union all
select 'CPU time' event
, to_number(null) waits
, :tcpu/100 time
, to_number(null) avwait
, decode( :tct_us, 0, 0
, 100 * (:tcpu*10000) / :tct_us
) pctwait
from dual
where :tcpu > 0
)
order by time desc, waits desc
)
where rownum <= &&top_n_events; |
|