Open Cursor count in the database [message #674574] |
Mon, 04 February 2019 03:51 |
|
saipradyumn
Messages: 419 Registered: October 2011 Location: Hyderabad
|
Senior Member |
|
|
Hi All,
We need query to get the opened cursors current in the total database for all sessions and for all users.
If I google it got the two different queries with two different result set.
Query1 :
SELECT a.value,
s.username,
s.sid,
s.serial#
FROM v$sesstat a,
v$statname b,
v$session s
WHERE a.statistic# = b.statistic#
AND s.sid =a.sid
AND b.name = 'opened cursors current'
Query2:
SELECT s.machine, oc.user_name, oc.sql_text, count(1) cnt
FROM v$open_cursor oc, v$session s
WHERE oc.sid = s.sid
GROUP BY user_name, sql_text, machine
--HAVING COUNT(1) > 2
ORDER BY count(1) DESC
Which one is appropriate to get the OPEN CURSOR COUNT in the database ?What is he difference between those queries and why it is giving the different result set ?
Thanks
SaiPradyumn
|
|
|
|
|
|
|