【MOS】High Version Count Due To BIND_MISMATCH (Doc ID 336268.1) -- 10503 events事件介绍

0    329    2

Tags:

👉 本文共约3541个字,系统预计阅读时间或需14分钟。

介绍

修复bug 2450264引入了一个新事件(10503),该事件允许用户指定字符绑定缓冲区长度。根据所使用的长度,子游标中的字符绑定可以全部使用相同的绑定长度创建。

对于绑定变量,ORACLE根据变量长度进行了分级,对于VARCHAR2类型共有如下4级:

第一级: 1-32
第二级: 33-128
第三级: 129-2000
第四级: 2000+

Oracle在进行bind graduation(绑定变量分级)的时候,使用的是绑定变量的声明类型长度。对于定义的变量在同一级可以共享游标,否则会生成子游标。

注意:

1、若是2个节点,则必须同时配置生效,否则可能会触发 ORA-600: [kxspoac : EXL 1] Occuring During Query If Event 10503 Is Set (Doc ID 810194.1)

2、该事件建议在session级别配置,否则可能会导致内存空间不足等问题,若在system级别配置,相当于所有的绑定变量都用2000字节的buffer,这会导致内存分配问题,另外,用完及时关闭。

3、根据 Bug 10274265 - Event 10503 does not work at session level (Doc ID 10274265.8),若数据库大于Versions >= 10.2 且 BELOW 12.1,则在session级别配置该事件并不起作用。

测试示例

通过上述的SQL代码进行测试,可以看到会话设置了10503事件之后,即使客户端声明的字符变量长度小于4000,语句变量传入数据库时,绑定变量的长度会被固定为4000。

但,如果会话是在SYSTEM级别配置的,那么其它会话的绑定变量的长度也会被分配2000或4000字节,这无疑会增加内存空间的使用量。

会话2:

会话3:

High Version Count Due To BIND_MISMATCH (Doc ID 336268.1)

APPLIES TO:

Oracle Database Cloud Schema Service - Version N/A and later
Gen 1 Exadata Cloud at Customer (Oracle Exadata Database Cloud Machine) - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.
Oracle Server Enterprise Edition - Version: 8.1.7.4

SYMPTOMS

Performance is bad due to high version count. V$SQL_SHARED_CURSOR shows new child cursors for the parent one due to BIND_MISMATCH.

CAUSE

This is due to the bind buffer mismatch of the current child cursor. If oracle is unable to bind the current value to the existing child cursors bind buffer, oracle upgrades the existing child cursor with a high bind buffer. This will force the query to
do a hard parse and a new child cursor will be created.

The previous one will be marked 'dont use'.

These types of cursors are never re-used. As a result, they permanently occupy a slot in the child table which will result in increasing the version count.

This issue has been described in the following bug:

Note: 2450264.8 Add event to improve cursor sharability

SOLUTION

The fix of the bug 2450264 has introduced a new event (10503) which enables users to specify a character bind buffer length. Depending on the length used, the character binds in the child cursor can all be created using the same bind length;

本人提供Oracle(OCP、OCM)、MySQL(OCP)、PostgreSQL(PGCA、PGCE、PGCM)等数据库的培训和考证业务,私聊QQ646634621或微信dbaup66,谢谢!
AiDBA后续精彩内容已被站长无情隐藏,请输入验证码解锁本文!
验证码:
获取验证码: 请先关注本站微信公众号,然后回复“验证码”,获取验证码。在微信里搜索“AiDBA”或者“dbaup6”或者微信扫描右侧二维码都可以关注本站微信公众号。

标签:

Avatar photo

小麦苗

学习或考证,均可联系麦老师,请加微信db_bao或QQ646634621

您可能还喜欢...

发表回复