您的位置:首页 > 大数据 > 人工智能

Determine the Blocking Session for Event: 'cursor: pin S wait on X' [ID 786507.1]【每日一译】--20121107

2012-11-07 10:27 531 查看
In this Document

Goal

Solution

References

在这篇文档里包含

目标

解决

相关资料

Applies to:

Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 11.2.0.3 - Release: 10.2 to 11.2

Oracle Server - Standard Edition - Version: 10.2.0.1 to 11.2.0.3 [Release: 10.2 to 11.2]

Oracle Server - Personal Edition - Version: 10.2.0.1 to 11.2.0.3 [Release: 10.2 to 11.2]

应用于:

ORACLE-企业版Version: 10.2.0.1 to 11.2.0.3 - Release: 10.2 to 11.2

ORACLE-标准版Version: 10.2.0.1 to 11.2.0.3 [Release: 10.2 to 11.2]

ORACLE-个人版Version: 10.2.0.1 to 11.2.0.3 [Release: 10.2 to 11.2]

Information in this document applies to any platform.

文档中的信息应用于所有的平台

Goal

This note helps find the blocking session for mutex related wait event "cursor: pin S wait on X"

目标

这个笔记帮助发现阻塞会话对于排斥相关的等待事件"cursor: pin S wait on X"

To Troubleshoot this event see:

对于解决此事件可以查看:

Document 1377998.1 Troubleshooting: Waits for Mutex Type Events

Document 1349387.1 Troubleshooting 'cursor: pin S wait on X' waits

Document 1356828.1 FAQ: 'cursor: mutex ..' / 'cursor: pin ..' / 'library cache: mutex ..' Type Wait Events

Document 1377446.1 Troubleshooting Performance Issues

Solution

解决

Cursor: pin S wait on X.

A session waits on this event when requesting a mutex for shareable operations related to pins (such as executing a cursor), but the mutex cannot be granted because it is being held exclusively by another session (which is most likely parsing the cursor).

一个会话等待这个事件当要求一个对于共享操作的排斥,与之有关的PINS(比如执行一个游标),当排拆不能赋权因为它正被其它的会话独占的保留(最可能的就是解析这个

游标)

The column P2RAW in v$session or v$session_wait gives the blocking session for wait event cursor: pin S wait on X.

列P2RAW在会话V$SESSION 或者V$SESSION_WAIT给出现对于等待事件”CURSOR.PIN S WAIT ON X“的阻塞会话。

The top bytes of p2raw is the blocker. It is in hex so needs to be converted in decimal.

P2RAW的字节内容是个阻塞者。它是16进制的所以需要转换成10进制。

SQL> select p2raw from v$session where event = 'cursor: pin S wait on X';

P2RAW

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

0000001F00000000

<SID> <RefCnt>

The top bytes of p2raw is the blocker.

Taking 0000001F (the first 8 bytes) and converting to decimal gives session id 31.

截取0000001F(前面8字节)并且转换成10进制的会话ID为31.

Or simply:

SQL> select p2raw,to_number(substr(to_char(rawtohex(p2raw)),1,8),'XXXXXXXX') sid

from v$session

where event = 'cursor: pin S wait on X';

P2RAW SID

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

0000001F00000000 31

64 bit platforms

8 bytes are used.

Top 4 bytes hold the session id (if the mutex is held X)

Bottom 4 bytes hold the ref count (if the mutex is held S).

64位平台

使用8字节

前面4字节保留了SESSION ID(如果是X排斥)

后面4字节保留了REF COUNT(如果是S排斥)

32 bit platforms

4 bytes are used.

Top 2 bytes hold the session id (if the mutex is held X)

Bottom 2 bytes hold the ref count (if the mutex is held S).

32位平台

4字节被使用

前面2字节保留了会话ID(如果是X排斥)

后面2节点保留了REF COUNT(如果是S排斥)

SQL> select p1, p2raw, count(*) from v$session

where event ='cursor: pin S wait on X'

and wait_time = 0

group by p1, p2raw;

p1 = the mutex Id

This has the same definition as v$mutex_sleep_history.mutex_identifier

它与视图v$mutex_sleep_history的字段mutex_identifier定义相同

p2raw = holding Session Id | Ref Count

The most significant bytes always store the Holding Session Id (Holding SId).

最深远的字节通常存储保留SESSION ID

The least significant bytes always store the Ref Count.

最少的字节通常存储REF COUNT。

The blocking session can be queried to see what it is doing and if anyone is blocking it.

这个阻塞会话可以被查询去查看它正在做什么如果有会话阻塞它。

SQL> select sid,serial#,SQL_ID,BLOCKING_SESSION,BLOCKING_SESSION_STATUS,EVENT

from v$session where SID=31;

As a result of Bug 7568642 BLOCKING_SESSION EMPTY FOR "CURSOR: PIN S WAIT ON X" the blocking_session is not populated in 10.2.The bug is fixed in 11g R1.

Bug 7568642的结果是字段BLOCKING_SESSION为空的对于"CURSOR: PIN S WAIT ON X" 的阻塞会话,在10.2中没有修复,此BUG在11GR1中修复。

In 11g, the blocking session can be found directly using the following sql:

SQL> select sid,serial#,SQL_ID,BLOCKING_SESSION,BLOCKING_SESSION_STATUS,EVENT

from v$session where event ='cursor: pin S wait on X'

SID SERIAL# SQL_ID BLOCKING_SESSION BLOCKING_SESSION_STATUS EVENT

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

125 8190 3d3pd7g7dwuf6 135 VALID cursor: pin S wait on X

Likely Causes

One of the most likely causes of cursor: pin S wait on X is high parsing time. Therefore the reason for the high parse time should be investigated.

可能的原因

最大可能的原因在于游标的高解析时间在事件pin S wait on X。所以对于高解析花费时间需要去分析。

References

BUG:7568642 - BLOCKING_SESSION EMPTY FOR "CURSOR: PIN S WAIT ON X"

相关

BUG:7568642 BLOCKING_SESSION为空间对于事件"CURSOR: PIN S WAIT ON X"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐