ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【DBA 脚本】查询current open cursor的脚本

【DBA 脚本】查询current open cursor的脚本

原创 Linux操作系统 作者:杨奇龙 时间:2010-08-31 15:57:51 0 删除 编辑
show parameter session_cached_cursor
drop view user_cursors;
create view user_cursors as
select
ss.username||'('||se.sid||') ' user_process, sum(decode(name,'recursive calls',value)) "Recursive Calls",
sum(decode(name,'opened cursors cumulative',value)) "Opened Cursors", sum(decode(name,'opened cursors current',value)) "Current Cursors"
        from v$session ss, v$sesstat se, v$statname sn
where  se.statistic# = sn.statistic#
                and (     name  like '%opened cursors current%'
                                OR name  like '%recursive calls%'
                                OR name  like '%opened cursors cumulative%')
                and  se.sid = ss.sid
                and     ss.username is not null
group by ss.username||'('||se.sid||') ';

ttitle 'Per Session Current Cursor Usage '
column USER_PROCESS format a25;
column "Recursive Calls" format 999,999,999;
column "Opened Cursors"  format 99,999;
column "Current Cursors"  format 99,999;

select * from user_cursors   
order by "Recursive Calls" desc;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22664653/viewspace-672248/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
MySQL DBA NoSQL DEVOPS

注册时间:2009-10-07

  • 博文量
    1026
  • 访问量
    8206295