WAITEVENT: "cursor: pin S wait on X" Reference Note (文档 ID 1298015.1)

"cursor: pin S wait on X" Reference Note

This is a reference note for the wait event  "cursor: pin S wait on X" 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 wait on X" when it wants a mutex in S (share) mode on a specific cursor but some other session holds that same mutex in X (exclusive) mode. Hence the current session has to wait for the X mode holder to release the mutex.
    Mutexes are local to the current instance in RAC environments.

Individual Waits:

  Parameters:
  Wait Time:
Typically each wait is a 10mS in releases up to (and including) 11.2.0.2 
A session will wait over and over on the same wait event until it acquires the mutex in S mode.
  Finding Blockers:
This specific wait implies that there is an X mode holder of the mutex at the time that this session requested it in S mode. Mutexes are instance local so in a RAC environment the holder is on the local instance. The holding session id is exposed in several ways:
If the blocking session remains the same for a long period of time then it is likely that session is taking a long time to parse the SQL statement indicated by the hash value in  P1 (idn).

Systemwide Waits:

There are 3 main scenarios that cause this event to show up system-wide:
  • One blocker with many waiting sessions wanting the same mutex
    This should be handled like any long duration hang scenario. 
    ie: Find the blocker and find out what they are doing that is taking a long time and investigate why. 
    eg: If many sessions issue an identical SQL statement but for some reason the statement takes an excessively long time to parse then many concurrent sessions can end up waiting for the blocker to finish its parse.


  • Changing blocker with many waiting sessions wanting the same mutex
    If the blocking session is changing frequently for the same  P1 (idn) value then it is likely that the SQL is not sharing for some reason and multiple sessions are having to build versions of the cursor. Find which SQL this is (See  P1 (idn) above) and then investigate if that cursor has a high VERSION_COUNT. 
    Eg: A typical example which could cause this would be a system using CURSOR_SHARING=SIMILAR for a heavily used SQL statement with a range predicate comparing a column to a literal (eg: where COL >  N where  N is a number which is different for each session). Such a statement would need a different child cursor for each distinct literal value - the statement itself does not take excessive time to parse, but lots of concurrent sessions are competing on the statement.


  • Changing blockers and changing mutexes
    This might occur if the shared pool is under load (or under sized), or if there are frequent cursor invalidations / flushes leading to lots of hard parsing of lots of different SQL statements which are executed by many sessions concurrently.


Information to help drill into systemwide waits can be obtained from:
  • V$ACTIVE_SESSION_HISTORY 
    Find common P1 (idn) values in the wait history for the "cursor: pin S wait on X" waits to home in on SQL which may be an issue. 
  • 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 problem SQL. 
  • AWR and / or V$SQLAREA
    SQL with a high VERSION_COUNT can be a cause of these waits although it is advisable to ensure there is a link to the mutex waits using the above views. eg: A statement may correctly have a high VERSION_COUNT but never contribute to cursor pin waits.

Reducing Waits / Wait times:

As this wait involves a wait for an X holder then the main approach to reducing waits is to identify the reason for either long or frequent acquisition of the mutex/es in X mode and tackle that.
  • For SQL with long parse times try to isolate that statement and use hints, outlines, plan management or other options to reduce the parse time. 

  • For SQL with high version counts try to reduce the need for multiple versions. In extreme cases where many child cursors must be used then it can help to spread the contention by making the SQL from different clients (or groups of clients) slightly different. eg: By adding a literal comment to the SQL so that each session (or group of sessions) map to a different hash_value and different parent cursor.

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


NBBugFixedDescription
 5650841 Hang / deadlock from ANALYZE of cluster index
 1619124812.1.0.1.1, 12.1.0.2, 12.2.0.0Hang from concurrent drop of on-commit materialized views or using DBMS_REDEFINITION
 1429525011.2.0.4, 12.1.0.1Long parse time for large query with many nested views due to much time in epxression analysis code
 1419150811.2.0.3.8, 11.2.0.3.BP16, 11.2.0.4, 12.1.0.1Slow row cache load due to SEG$ and INDSUBPART$ queries
 1417624711.2.0.4, 12.1.0.1Many child cursors using Adaptive Cursor Sharing with binds (due to BIND_EQUIV_FAILURE)
 1640012212.2.0.0Spikes in library cache mutex contention for SQL using SQL Plan Baseline
 1585003111.2.0.4, 12.2.0.0Rare instance hang: deadlock between 'row cache lock' and 'cursor: pin S wait for X'
 1446975612.2.0.0Partition pruning causes delay in TBL$OR$IDX$PART$NUM
 1430281311.2.0.4, 12.2.0.0QC blocked / parse hang for parallel DML executed from remote stored procedure
 1402989111.2.0.4, 12.1.0.1mutex deadlock having SQL baselines on recursive dictionary cursor
 1192761911.2.0.1.BP11, 11.2.0.2.BP07, 11.2.0.3, 12.1.0.1DBMS_STATS slow on interval composite partitions
 1185596511.2.0.3, 12.1.0.1Truncate partition takes long time doing recursive delete on MLOG$
 1021307311.2.0.2.8, 11.2.0.2.BP18, 11.2.0.3, 12.1.0.1CREATE SYNONYM and CREATE PACKAGE may incorrectly invalidate objects
 1017127311.2.0.2.8, 11.2.0.2.BP08, 11.2.0.3, 12.1.0.1Long parse time with non-equi subpartitioning under interval partitioning
 994412911.2.0.1.BP12, 11.2.0.2, 12.1.0.1SQL not shared due to INST_DRTLD_MISMATCH with global transaction
 993578711.2.0.3, 12.1.0.1Long parse time for large inlists - can cause 'cursor: pin S wait on X' waits
 969410110.2.0.5.7, 11.2.0.2, 12.1.0.1Hang / deadlock between "cursor: pin S wait on X" and "library cache lock" involving dictionary objects
 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
 947266911.2.0.1.BP12, 11.2.0.2, 12.1.0.1'cursor: pin S wait on X' waits for invalid SQL over DB link
 850807811.2.0.2, 12.1.0.1Contention from many concurrent bad SQLs - superseded
 1243208911.2.0.3library cache lock/cursor: pin Ss wait on S with parallel partition stats gathering
 844123911.2.0.1Library cache lock waits if long running TRUNCATE in progress
 834846411.1.0.7.2, 11.2.0.1CREATE SYNONYM and CREATE PACKAGE may incorrectly invalidate objects
 723477811.2.0.1Unnecessary "cursor: pin S wait on X" waits
 548591410.2.0.4Mutex self deadlock on explain / trace of remote mapped SQL
 614342010.2.0.5, 11.1.0.6Deadlock involving "ROW CACHE LOCK" on dc_users AND "CURSOR: PIN S WAIT ON X"
 601104510.2.0.5.5DBMS_STATS causes deadlock between 'cursor: pin S wait on X' and 'library cache lock'
 746207210.2.0.4.3, 10.2.0.5Unnecessary "cursor: pin S wait on X" waits
 598302010.2.0.4MMON deadlock with user session executing ALTER USER
 722646310.2.0.5EXECUTE IMMEDIATE no releasing mutex or library cache pin
+590777910.2.0.4Self deadlock hang on "cursor: pin S wait on X" (typically from DBMS_STATS)
  • '*' 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.
  • Fixed versions use "BPnn" to indicate Exadata bundle nn.
  • "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 wait on X" waits for customers. Any bug issue which causes high version counts or causes long parse times could also lead to such waits if there is some degree of concurrency .

Related:


  Note:786507.1  Finding the blocking session for a "cursor: pin S wait on X" wait
  Note:1349387.1 Troubleshooting: 'cursor: pin S wait on X' waits
  Note:1377998.1 Troubleshooting: Waits for Mutex Type Events

 
 

相关内容

   
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值