Update 35_get_cursor_usage.sql
This commit is contained in:
@@ -1,49 +1,40 @@
|
||||
-- SCRIPT - to Set the 'SESSION_CACHED_CURSORS' and 'OPEN_CURSORS' Parameters Based on Usage (Doc ID 208857.1)
|
||||
prompt <h2>Sessions and Cursors usage </h2>
|
||||
select
|
||||
'session_cached_cursors' parameter,
|
||||
lpad(value, 5) value,
|
||||
decode(value, 0, ' n/a', to_char(100 * used / value, '990') || '%') usage
|
||||
'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 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'
|
||||
(
|
||||
select value
|
||||
from v$parameter
|
||||
where name = 'session_cached_cursors'
|
||||
)
|
||||
union all
|
||||
select
|
||||
'open_cursors',
|
||||
lpad(value, 5),
|
||||
to_char(100 * used / value, '990') || '%'
|
||||
'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') and
|
||||
s.statistic# = n.statistic#
|
||||
group by
|
||||
s.sid
|
||||
(
|
||||
select max(sum(s.value)) used
|
||||
from v$statname n, v$sesstat s
|
||||
where
|
||||
n.name in ('opened cursors current') and
|
||||
s.statistic# = n.statistic#
|
||||
group by s.sid
|
||||
),
|
||||
( select
|
||||
value
|
||||
from
|
||||
v$parameter
|
||||
where
|
||||
name = 'open_cursors'
|
||||
(
|
||||
select value
|
||||
from v$parameter
|
||||
where name = 'open_cursors'
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user