Tune the session_cached_cursor parameter
#This is my preferred query:
select a.sid, a.username, a.tot_parse_count, a.session_cursor_cache_hits,
session_cursor_cache_count, currently_opened,
decode(a.tot_parse_count, 0, 0, a.session_cursor_cache_hits*100/a.tot_parse_count) "%",
osuser, machine, terminal, program, module, action, event, state from (
select s.sid, s.username,
(select value from V$sesstat a, v$statname b where a.statistic# = b.statistic#
and s.sid = a.sid and b.name = 'parse count (total)') tot_parse_count,
(select value from V$sesstat a, v$statname b where a.statistic# = b.statistic#
and s.sid = a.sid and b.name = 'session cursor cache hits') session_cursor_cache_hits,
(select value from V$sesstat a, v$statname b where a.statistic# = b.statistic#
and s.sid = a.sid and b.name = 'session cursor cache count') session_cursor_cache_count,
(select value from V$sesstat a, v$statname b where a.statistic# = b.statistic#
and s.sid = a.sid and b.name = 'opened cursors current') currently_opened,
osuser, machine, terminal, program, module, action, event, state
from v$session s
) a
order by tot_parse_count desc
| sid |
username |
tot_parse_count |
session_cursor_cache_hits |
session_cursor_cache_count |
currently_opened |
% |
osuser |
machine |
terminal |
program |
module |
action |
event |
state |
| 137 |
ALDO |
13219 |
56682 |
1848 |
6 |
428,791890460701 |
| PC-root |
| | | | SQL*Net message from client |
WAITING |
First of all bear in mind mind that you may dramatically reduce the value of session_cursor_cache_count with a good
instance tuning, this must be done before. See Tuning
There is not a defined rule to tune session_cached_cursors, basically you should increase until you see
the session_cursor_cache_count go below the parameter.
In my example you see my perfectly tuned session_cached_cursors=2000, also look at the very low number of currently opened
cursors that means the application correctly closes all cursors(...I'm the developer :))
#Or:
select (select value from V$SYSSTAT where name = 'parse count (total)') /
(select value from V$SYSSTAT where name = 'session cursor cache hits') perc_session_cursor_cache_hits
from dual
The more you raise session_cached_cursor the closest is the result to zero
Anyway is a good idea to set the session_cached_cursors also taking a look at the number of cursors opened (see above)
|