时间:2021-07-01 10:21:17 帮助过:11人阅读
查看session open cursor的具体程式、open cursor数量:
SELECT a.inst_id, a.sid, a.USERNAME, a.SCHEMANAME, a.OSUSER, a.machine, a.TERMINAL, a.LOGON_TIME, a.PROGRAM, a.STATUS, b.name, b.used FROM gv$session a, (SELECT n.inst_id, sid, n.name, s.VALUE used FROM gv$statname n, gv$sesstat s WHERE n.name IN (‘opened cursors current‘, ‘session cursor cache count‘) AND s.statistic# = n.statistic# AND n.inst_id = s.inst_id) b WHERE a.sid = b.sid AND a.inst_id = b.inst_id AND b.name <> ‘session cursor cache count‘ ORDER BY b.used DESC;
查看session open cursor的具体SQL(此方法是联合v$open_cursor得出的结果,可能有不准确。但session最多open_cursors的SQL一定是在运行结果中)
SELECT distinct a.inst_id, a.sid, a.USERNAME, a.SCHEMANAME, a.OSUSER, a.machine, a.TERMINAL, a.LOGON_TIME, a.PROGRAM, a.STATUS, b.name, b.used,c.sql_id FROM gv$session a, (SELECT n.inst_id, sid, n.name, s.VALUE used FROM gv$statname n, gv$sesstat s WHERE n.name IN (‘opened cursors current‘, ‘session cursor cache count‘) AND s.statistic# = n.statistic# and n.inst_id=s.inst_id ) b,v$open_cursor c WHERE a.sid = b.sid and a.inst_id = b.inst_id and a.sid=c.sid and c.CURSOR_TYPE in(‘OPEN‘,‘OPEN-PL/SQL‘,‘OPEN-RECURSIVE‘) and b.name <> ‘session cursor cache count‘ order by b.used desc;
Oracle查看 open_cursors 和 session_cached_cursors
标签:union all use class man terminal blog pac highlight 最大