如何在 Oracle 中显示打开的游标?
oraclesoftware & codingprogramming
问题:
您想在 Oracle 中显示打开的游标。
解决方案
我们可以查询数据字典来确定每个会话打开的游标数量。"V$SESSION"提供比"V$OPEN_CURSOR"更准确的当前打开的游标数量。
示例
select a.value ,c.username ,c.machine ,c.sid ,c.serial# from v$sesstat a ,v$statname b ,v$session c where a.statistic# = b.statistic# and c.sid = a.sid and b.name = 'opened cursors current' and a.value != 0 and c.username IS NOT NULL order by 1,2;
OPEN_CURSORS 初始化参数决定会话可以打开的最大游标数。