Professional Documents
Culture Documents
SCRIPT - To Tune The 'SESSION - CACHED - CURSORS' and 'OPEN - CURSORS' Parameters (ID 208857.1)
SCRIPT - To Tune The 'SESSION - CACHED - CURSORS' and 'OPEN - CURSORS' Parameters (ID 208857.1)
208857.1]
Abstract
SCRIPT - to Tune the 'SESSION_CACHED_CURSORS' and 'OPEN_CURSORS' Parameters
Oracle Server Enterprise Edition
Product Name, Product Version
Versions 8i, 9i, 10g and 11g.
Platform GENERIC
Date Created 24-Nov-2002
Instructions
Execution Environment:
SQL*Plus
Access Privileges:
Requires user access to v$statname, v$sesstat, v$parameter,
Usage:
sqlplus <user>/<pw> @[SCRIPTFILE]
Instructions:
PROOFREAD THIS SCRIPT BEFORE USING IT! Due to differences in the way text
editors, e-mail packages, and operating systems handle text formatting
(spaces,
tabs, and carriage returns), this script may not be in an executable state
when you first receive it. Check over the script to ensure that errors of
this type are corrected.The script will produce an output file named
[outputfile].
This file can be viewed in a browser or uploaded for support analysis.
Description
To allow the DBA/Analysts to check whether the sessions cursor cache or
open cursors are really a constraint and then increase the parameter
session_cached_cursors or open_cursors accordingly.
References
Note:1012049.6 Tuning Library Cache Latch Contention
Script
select
'session_cached_cursors' parameter,
lpad(value, 5) value,
decode(value, 0, ' n/a', to_char(100 * used / value, '990') || '%') usage
from
( select
max(s.value) used
from
v$statname n,
v$sesstat s
where
n.name = 'session cursor cache count' and
s.statistic# = n.statistic#
),
( select
value
from
v$parameter
where
name = 'session_cached_cursors'
)
union all
select
'open_cursors',
lpad(value, 5),
to_char(100 * used / value, '990') || '%'
from
( select
max(sum(s.value)) used
from
v$statname n,
v$sesstat s
where
n.name in ('opened cursors current', 'session cursor cache count') and
s.statistic# = n.statistic#
group by
s.sid
),
( select
value
from
v$parameter
where
name = 'open_cursors'
)
/
Sample Output
PARAMETER VALUE USAGE
---------------------- -------- ---------
session_cached_cursors 0 n/a
open_cursors 300 1%