如何正确设置session_cached_cursors参数

转载自:http://blog.itpub.net/20542911/viewspace-624681

正确设置open_cursors和'session_cached_cursors'  可以减少sql解析,提高系统性能,那么,如何正确设置'session_cached_cursors'  这个参数呢?我们可以把握下面的原则:

1、'session_cached_cursors'  数量要小于open_cursor

2、要考虑共享池的大小

3、使用下面的sql判断'session_cached_cursors'  的使用情况。如果使用率为100%则增大这个参数值。

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')
原文地址:https://www.cnblogs.com/wqswjx/p/5548639.html