oracle 11g open_cursors 修改,修改open_cursors和session_cached_cursors的参数值

这篇博客讨论了Oracle数据库性能优化,通过ADDM报告发现软解析SQL语句消耗大量数据库时间。建议检查应用程序逻辑以保持常用游标打开,并考虑增加open_cursors和session_cached_cursors参数值,以减少共享池的锁争用和并发等待时间,提升系统性能。默认值分别为300和20,建议调整为1500和100。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

用oracle 的ADDM生产了报告,其中建议修改open_cursors和session_cached_cursors的参数值。

如:

FINDING 3: 15% impact (1673 seconds)

------------------------------------

Soft parsing of SQL statements was consuming significant database time.

RECOMMENDATION 1: Application Analysis, 15% benefit (1673 seconds)

ACTION: Investigate application logic to keep open the frequently used

cursors. Note that cursors are closed by both cursor close calls and

session disconnects.

RECOMMENDATION 2: DB Configuration, 15% benefit (1673 seconds)

ACTION: Consider increasing the maximum number of open cursors a session

can have by increasing the value of parameter "open_cursors".

ACTION: Consider increasing the session cursor cache size by increasing

the value of parameter "session_cached_cursors".

RATIONALE: The value of parameter "open_cursors" was "300" during the

analysis period.

RATIONALE: The value of parameter "session_cached_cursors" was "20"

during the analysis period.

SYMPTOMS THAT LED TO THE FINDING:

SYMPTOM: Contention for latches related to the shared pool was consuming

significant database time. (30% impact [3316 seconds])

INFO: Waits for "latch: library cache" amounted to 12% of database

time.

Waits for "library cache pin" amounted to 4% of database time.

Waits for "latch: shared pool" amounted to 13% of database

time.

SYMPTOM: Wait class "Concurrency" was consuming significant database

time. (36% impact [3882 seconds])

SQL> show parameter cursors

NAME                                 TYPE        VALUE

------------------------------------ ----------- -----------------------

open_cursors                         integer     300

session_cached_cursors               integer     20

SQL>

alter system set open_cursors=1500 scope=both;

alter system set session_cached_cursors=100 scope=spfile;  (初始化文件使用了spfile)

open_cursors:该参数含义是同一个session同时打开最多在使用的游标数。

在Oracle10.2.0.1.0版本中默认为300;

session_cached_cursors:SESSION_CACHED_CURSORS,就是说的是一个session可以缓存多少个cursor,让后续相同的SQL语句不再打开游标,从而避免软解析的过程来提高性能。(绑定变量是解决硬解析的问题),软解析同硬解析一样,比较消耗资源.所以这个参数非常重要。

在Oracle10.2.0.1.0版本中默认为20

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值