Ai
1 Star 1 Fork 0

冯际成/Oracle_SQL_Scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
sql_wait_on_event_ash.sql 1.35 KB
一键复制 编辑 原始数据 按行查看 历史
Abdul mohammed 提交于 2016-02-06 08:58 +08:00 . Fri Feb 5 18:58:16 CST 2016
--sql_wait_on_event_ash.sql(last 10 mins)
---- time waited and wait time in microsecond
prompt
accept how_many_min_back prompt "How many minutes do you want to go back? "
accept event prompt "Enter event name like log file sync or db file sequential read to look at : "
Prompt
Prompt Top 15 SQLID causing &event in last &how_many_min_back minutes
select * from (
select event, sql_id, count(*),
avg(time_waited)*0.001 avg_time_waited_ms --*0.000001 avg_time_waited_s
from gv$active_session_history ash
where ash.event like nvl('&event','%more data from%')
and ash.SAMPLE_TIME > sysdate - ('&how_many_min_back'/(24*60))
group by event, sql_id
order by 3 desc)
where rownum < 16;
Prompt Top 15 Module causing &event in last &how_many_min_back minutes
select * from (
select module, count(*) from gv$active_session_history ash
where ash.event like nvl('&event','%more data from%') and ash.SAMPLE_TIME > sysdate - ('&how_many_min_back'/(24*60))
group by module order by 2 desc )
where rownum < 16;
Prompt Top 15 Module and SQLID(grouped) causing &event in last &how_many_min_back minutes
select * from (
select module,sql_id, count(*) from gv$active_session_history ash
where ash.event like nvl('&event','%more data from%') and ash.SAMPLE_TIME > sysdate - ('&how_many_min_back'/(24*60))
group by module,sql_id order by 3 desc )
where rownum < 16;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sapall/Oracle_SQL_Scripts.git
git@gitee.com:sapall/Oracle_SQL_Scripts.git
sapall
Oracle_SQL_Scripts
Oracle_SQL_Scripts
master

搜索帮助