cursor:mutex S和library cache lock 等待事件

一、问题描述

首先erp客户端无法登陆,登录系统查看发现cpu已经达到100%,用系统用户登录oracle数据库后,

查看等待事件:

SELECT event, COUNT(9) FROM v$session GROUP BY event;
查看等待事件相关的sql_id:
SELECT sql_id, COUNT(1) FROM v$session WHERE event = 'cursor: mutex S' GROUP BY sql_id;

查看相关sql语句:

SELECT sql_fulltext,sql_text FROM v$sql WHERE sql_id = '50u4uqg9vjk78';

查看该sql的version_count发现已经超过2000:

select sql_id,version_count from v$sqlarea where version_count> 500 order by 2 desc;

查看绑定变量不成功的原因:

SELECT COUNT(*) FROM v$sql_shared_cursor where sql_id='3axf89cxy7cv5' and bind_mismatch='Y';

查看该sql的子游标个数:

SQL>  select count(CHILD_NUMBER) from v$sql_shared_cursor where sql_id='50u4uqg9vjk78';


COUNT(CHILD_NUMBER)
-------------------
                935

查看该sql占用的内存大小:

SELECT SUM (sharable_mem) / 1024 / 1024 || 'M' FROM v$sqlarea where sql_id='50u4uqg9vjk78';


SUM(SHARABLE_MEM)/1024/1024||'M'
-----------------------------------------
21.51724147796630859375M

二、此问题是oracle 11.2.0.1版本的bug,可以通过打补丁解决问题。

也可以通过

SQL> alter system set "_cursor_features_enabled"=34 scope=spfile;
System altered.
SQL> alter system set event='106001 trace name context forever,level 1024' scope=spfile;
System altered.

这样来解决,参数“cursor_features_enabled”需要重启才可生效。


你可能感兴趣的:(ORACLE技术类)