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

简介: show parameter session_cached_cursordrop view user_cursors;create view user_cursors asselect ss.
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;
目录
相关文章
|
SQL 时序数据库
Influx Sql系列教程六:insert 修改数据
在influxdb中没有专门的修改数据的update语句,对于influxdb而言,如果想修改数据,还是得使用我们前面的说到的insert来实现,那么怎么判断一条insert语句是插入还是修改呢?
751 0
|
4月前
|
SQL 数据库
导入 sql 文件,如果发生 ERROR 1046 (3D000) no database selected 错误
导入 sql 文件,如果发生 ERROR 1046 (3D000) no database selected 错误
60 0
|
11月前
|
SQL Shell
【已解决】SQL2012启动时报错:cannot find one or more cpmponents
下载Microsoft Visual Studio 2010 Shell(Isolate)-CHS安装即可 下载地址:Visual Studio 独立 Shell 下载及安装:点击同意许可,选择vs2010独立shell(zh-CN) 安装完成,重启SQL ServerManagement Studio 即可
33 0
|
SQL 存储 运维
用 Show Profile 进行 sql 分析|学习笔记
快速学习用 Show Profile 进行 sql 分析
122 0
用 Show Profile 进行 sql 分析|学习笔记
使用SELECT和OPEN CURSOR读取product数据的一些讨论
使用SELECT和OPEN CURSOR读取product数据的一些讨论
191 0
使用SELECT和OPEN CURSOR读取product数据的一些讨论
|
SQL
SQL Server Update:使用 TOP 限制更新的数据
原文 使用 TOP 限制更新的数据 可以使用 TOP 子句来限制 UPDATE 语句中修改的行数。当 TOP (n) 子句与 UPDATE 一起使用时,将针对随机选择的 n 行执行删除操作。例如,假设您要为一位高级销售人员减轻销售负担,而将一些客户分配给了一位初级销售人员。
1565 0
|
SQL 关系型数据库 Oracle
[20150803]无法通过sql_id找到sql语句2.txt
[20150803]无法通过sql_id找到sql语句2.txt --前一阵子,在做优化时遇到1个无法通过sql_id找到sql语句的情况: http://blog.itpub.net/267265/viewspace-1749265/ --就是因为共享池太小,执行次数少,没到取样时间,已经从共享池清除。
1095 0