问题:
您要在Oracle中显示打开的游标。
解
我们可以查询数据字典以确定每个会话打开的游标数。与“ V $OPEN_CURSOR”相比,“ V $SESSION”提供的当前打开的游标数更准确。
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初始化参数确定会话可以打开的最大游标数。