Open cursors metric and
the following query
select sid,value from v$sesstat where statistic# in (select statistic# from v$statname where name='opened cursors current') and sid=20;
gives the list of count of cursors that are open by the session currently,
but the the following script
select sid,count(*) from v$open_cursor where sid=20 group by sid;
gives the number of cursors that are open by the session and are parsed.
But i just connected to the database and please see the following count.
SQL> select sid,value from v$sesstat where statistic# in (select statistic# from v$statname where name='opened cursors current') and sid=20;
SID VALUE
---------- ----------
20 3
SQL> select sid,count(*) from v$open_cursor where sid=20 group by sid;
SID COUNT(*)
---------- ----------
20 43
My question is that is the count that i am seeing in the v$open_cursor the complete number of cursors opened by a session during the life time? and v$sesstat gives only the count that is currently open....
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL>