2 Star 0 Fork 0

mirrors_ReneNyffenegger/fatdba-Oracle-Database-Scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
p_ash_events.sql 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
Prashant Dixit 提交于 2022-03-03 13:23 . Create p_ash_events.sql
undef wait_event
undef last_x_days
@plusenv
col tcnt format 99999 head 'Event|Cnt'
col event format a32 head 'Event' trunc
col pctcnt format 999.9 head 'Pct%'
col sqlid_c format a17 head 'SqlId:Child'
col obj format a08 head 'ObjId'
col obj_name format a65 head 'Object : SubObject' trunc
break on event
select event
,sqlid_c
,obj_name
,tcnt
from
(
select decode(ash.sql_id,null,'['||ash.module||']',(ash.sql_id||':'||ash.sql_child_number)) sqlid_c
,ash.event event
,decode(ash.session_state,'ON CPU',null,decode(o.object_name,null,to_char(ash.current_obj#),o.owner||'.'||o.object_name||decode(o.subobject_name,null,' ',' : '||subobject_name))) obj_name
,sum(decode(ash.session_state,'ON CPU',1,1)) tcnt
from v$active_session_history ash
,dba_objects o
where ash.event = '&&wait_event'
and ash.session_state = 'WAITING'
and ash.is_sqlid_current = 'Y'
and sample_time >= sysdate - &&last_x_days
and ash.current_obj# > 0
and ash.current_obj# = o.object_id (+)
group by decode(ash.sql_id,null,'['||ash.module||']',(ash.sql_id||':'||ash.sql_child_number))
,ash.event
,decode(ash.session_state,'ON CPU',null,decode(o.object_name,null,to_char(ash.current_obj#),o.owner||'.'||o.object_name||decode(o.subobject_name,null,' ',' : '||subobject_name)))
)
where rownum <= 10
order by tcnt desc
;
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_ReneNyffenegger/fatdba-Oracle-Database-Scripts.git
git@gitee.com:mirrors_ReneNyffenegger/fatdba-Oracle-Database-Scripts.git
mirrors_ReneNyffenegger
fatdba-Oracle-Database-Scripts
fatdba-Oracle-Database-Scripts
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385