WAITEVENT: "cursor: pin S" Reference Note (文档 ID 1310764.1)

"cursor: pin S" Reference Note

This is a reference note for the wait event  "cursor: pin S" which includes the following subsections: See  Note:61998.1 for an introduction to Wait Events.

Definition:

  • Versions:10.2 - 11.2 Documentation:10.2 11.1 11.2
  • Mutexes were introduced in Oracle 10.2.
    A session waits for "cursor: pin S" when it wants a specific mutex in S (share) mode on a specific cursor and there is no concurrent X holder but it could not acquire that mutex immediately. This may seem a little strange as one might question why there should be any form of wait to get a mutex which has no session holding it in an incompatible mode. The reason for the wait is that in order to acquire the mutex in S mode (or release it) the session has to increment (or decrement) the mutex reference count and this requires an exclusive atomic update to the mutex structure itself. If there are concurrent sessions trying to make such an update to the mutex then only one session can actually increment (or decrement) the reference count at a time. A wait on "cursor: pin S" thus occurs if a session cannot make that atomic change immediately due to other concurrent requests. 
    Mutexes are local to the current instance in RAC environments.

Individual Waits:

  Parameters:
  Wait Time:
Typically each wait is just a yield of the CPU in releases up to (and including) 11.2.0.2 
unless the fix for 
bug 10411618 is installed and active.
A session will wait over and over on the same wait event until it acquires the mutex in S mode. If the wait is just a yield of the CPU then this can result in quite a high amount CPU, especially if there is very heavy concurrency for a particular cursor.
  Finding Blockers:
There is no actual blocker for this wait. Sessions wanting to acquire or release a specific mutex in S mode have to make an atomic update to the mutex structure and will register the wait if they are having trouble doing that due to many other concurrent sessions trying to acquire or release the same mutex.

Systemwide Waits:

The main scenarios that cause this event to show up system-wide are:
  • Heavy concurrency for a specific mutex, especially on systems with multiple CPUs
    Use Active Session History (ASH) data, or sampled waits / 10046 trace to find the hot SQL statements. Typically these will be SQLs showing high Gets / Executions in AWR reports. The waits can actually appear worse for well tuned applications due to increased concurrency on specific SQLs.


  • Waits for very many different "idn" values when under load
    If the system is CPU starved already then the "cursor: pins S" waits can occur across lots of cursors and the problem can become self aggravating as the waiting sessions can also push up CPU .


Information to help drill into systemwide waits can be obtained from:
  • V$ACTIVE_SESSION_HISTORY / ASH reports
    Find common 
    P1 (idn) values in the wait history for the "cursor: pin S" waits to home in on SQL which may be heavily competed. 
  • V$MUTEX_SLEEP_HISTORY
    The MUTEX_IDENTIFIER column is the same as the P1 (idn) value exposed in V$SESSION_WAIT - it can be used to help identify hot SQL. 
  • AWR and / or V$SQLAREA
    SQL with a very high executions executed by multiple concurrent sessions are typically the hot SQL causing the majority of waits.

Reducing Waits / Wait times:

Ensure that the version that you are using either has a some form of backoff or sleep option in place and enabled for "cursor: pin S" mutex waits. eg: By using the fix for  Bug:6904068 and setting the sleep time parameter to "1" for that fix (pre 11.2)
or for 11.2 releases ensure that the fix for  bug 10411618 is installed and active. 
This should help give breathing space between sessions competing for the same mutex thus avoiding CPU usage escalating and aggravating the waits. 

For any identified "hot" SQLs one can reduce the concurrency on specific cursors by replacing the one SQL with some variants which are executed by different sessions. 
eg: Consider "select name from acct where acctno=:1" is a very hot
    SQL statement then if clients can be put into groupings with: 
     some using "select /*A*/ name from acct where acctno=:1", 
     some using "select /*B*/ name from acct where acctno=:1", 
     some using "select /*C*/ name from acct where acctno=:1", 
    etc.. then the concurrency against any one of the SQLs can be reduced.


Known Bugs
You can restrict the list below to issues likely to affect one of the following versions by clicking the relevant button: 
                   


NBBugFixedDescription
P1605378111.1.0.6, 11.2.0.4VMS: ORA-600 [kgxEndExamine-Bad-State] / 'cursor: pin S' waits in 10.2.0.5
 1402989111.2.0.4, 12.1.0.1mutex deadlock having SQL baselines on recursive dictionary cursor
 1041161811.1.0.7.9, 11.2.0.1.BP12, 11.2.0.2.2, 11.2.0.2.BP06, 11.2.0.3, 12.1.0.1Enhancement to add different "Mutex" wait schemes
 1027088811.2.0.2.BP06, 11.2.0.3, 12.1.0.1ORA-600[kgxEndExamine-Bad-State] / mutex waits after a self deadlock - superseded
 959181211.2.0.1.BP08, 11.2.0.2.2, 11.2.0.2.BP03, 11.2.0.3, 12.1.0.1Wrong wait events in 11.2 ("cursor: mutex S" instead of "cursor: mutex X")
 949930210.2.0.5.5, 11.1.0.7.7, 11.2.0.1.BP08, 11.2.0.2, 12.1.0.1Improve concurrent mutex request handling
 6904068 High CPU usage when there are "cursor: pin S" waits
 744116510.2.0.5, 11.2.0.2Prevent preemption while holding a mutex (fix only works on Solaris)
 679588010.2.0.5, 11.1.0.7Session spins / OERI after 'kksfbc child completion' wait - superceded
  • '*' indicates that an alert exists for that issue.
  • '+' indicates a particularly notable issue / bug.
  • 'I' indicates an install issue / bug included for completeness.
  • 'P' indicates a port specific bug.
  • "OERI:xxxx" may be used as shorthand for ORA-600 [xxxx].

Note:

The above bug list shows only bugs tagged specifically as having caused "cursor: pin S" waits for customers.

Related:

  Note:1356828.1 Understanding 'cursor: mutex ..' / 'cursor: pin ..' / 'library cache: mutex ..' Type Wait Events


 
 

相关内容

   
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值