--顯示指定用戶打開的游標(biāo)數(shù) user_name = 指定用戶
select o.sid, osuser, machine, count(*) num_curs
from v$open_cursor o, v$session s
where user_name = 'GTGDH' and o.sid=s.sid
group by o.sid, osuser, machine
order by num_curs desc;
--獲取為游標(biāo)執(zhí)行的SQL語句 o.sid = 打開游標(biāo)的SID
select q.sql_text
from v$open_cursor o, v$sql q
where q.hash_value=o.hash_value and o.sid = 11;