如何在 Oracle 中顯示開啟的游標?
問題
您想在 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 初始化引數決定了一個會話可開啟的最大游標數。
廣告