-
--session cached cursors, by session
-
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 = 'session cursor cache count' and a.value<>0 order by 1;
col user_name for a22
col sql_text for a80
col sql_id for a13
-
select c.user_name, c.sid, sql.sql_text,c.sql_id,c.hash_value
-
from v$open_cursor c, v$sql sql
-
where c.sql_id=sql.sql_id -- for 9i and earlier use: c.address=sql.address
-
and c.sid=&sid;
调整会话游标缓存 (session_cached_cursors)
-
--确定特定会话中当前缓存的游标数
-
col max_cached for a12
-
select a.value curr_cached, p.value max_cached,
-
s.username, s.sid, s.serial#
-
from v$sesstat a, v$statname b, v$session s, v$parameter2 p
-
where a.statistic# = b.statistic# and s.sid=a.sid and a.sid=&sid
-
and p.name='session_cached_cursors'
-
and b.name = 'session cursor cache count' ;
-
--查找在会话游标缓存中找到游标的解析调用的百分比
-
select cach.value cache_hits, prs.value all_parses,round((cach.value/prs.value)*100,2) as "% found in cache"
-
from v$sesstat cach, v$sesstat prs, v$statname nm1, v$statname nm2
-
where cach.statistic# = nm1.statistic#
-
and nm1.name = 'session cursor cache hits'
-
and prs.statistic#=nm2.statistic#
-
and nm2.name= 'parse count (total)'
-
and cach.sid= &sid and prs.sid= cach.sid;
当以下陈述为真时,请考虑增加session_cursor_cache: