cursor: pin S

cursor: pin S

OTN 解释如下:

  cursor: pin SA session waits on this event when it wants to update a shared mutex pin and another session is currently in the process of updating a shared mutex pin for the same cursor object. This wait event should rarely be seen because a shared mutex pin
update is very fast.(Wait Time: Microseconds)
Parameter Description
P1 Hash value of cursor
P2 Mutex value (top 2 bytes contains SID holding mutex in exclusive mode, and bottom two bytes usually hold the value 0)
P3 Mutex where (an internal code locator) OR’d with Mutex Sleeps

今天收集性能报告Top 5 

 

Top 5 Timed Foreground Events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                           Avg
                                                          wait   % DB
Event                                 Waits     Time(s)   (ms)   time Wait Class
------------------------------ ------------ ----------- ------ ------ ----------
DB CPU                                          205,412          99.8
db file sequential read              68,063         487      7     .2 User I/O
log file sync                       139,316         233      2     .1 Commit
cursor: pin S                     1,163,270         127      0     .1 Concurrenc
SQL*Net message from dblink          97,575          46      0     .0 Network

Oracle10gR2中引用的mutexes机制一定程度的替代了library cache pin,其结构更简单,相当于,每个child cursor下面都有一个mutexes这样的简单内存结构,当有session中要执行该SQL而需要pin cursor操作的时候,session需要以shared模式set这个内存位+1,表示session获得该mutex的shared mode lock.可以有很多session同时具有这个mutex的shared mode lock;但是在同一时间,只能有一个session在操作这个mutext
+1或者-1。+1 -1的操作是排它性的原子操作。如果因为session并行太多,则导致某个session在等待其他session的mutext +1/-1操作,则该session要等待cursor: pin S等待事件。

当看到系统有很多session等待cursor: pin S事件的时候,要么是CPU不够快,要么是某个SQL的并行执行次数太多了而导致在child cursor上的mutex操作争用。如果是前者,则可以升级硬件。如果是因为SQL的并行太多,则要么想办法降低该SQL执行次数,要么将该SQL复制成N个其它的SQL。

    select /*SQL 1*/ename from t where deptno=?
    select /*SQL 2*/ename from t where deptno=?
    select /*SQL …*/ename from t where deptno=?
    select /*SQL N*/ename from t where deptno=?

这样就有了N个SQL Cursor,N个Mutex内存结构,就将争用分散开来,类似partition的作用了。

时间: 2024-08-30 16:32:25

cursor: pin S的相关文章

[20170707]cursor: pin S wait on X(10G)

[20170707]cursor: pin S wait on X(10G).txt --生产系统遇到1个bug,版本: EXAM@xxx> @ &r/ver1 PORT_STRING         VERSION    BANNER ------------------- ---------- ---------------------------------------------------------------- x86_64/Linux 2.4.xx 10.2.0.4.0 Or

[20130628]关于cursor pin S以及cursor pin S wait on X的相关问题.txt

[20130628]关于cursor pin S以及cursor pin S wait on X的相关问题.txt 生产系统最近一段时间总是出现cursor pin S wait on X,以前从来没有遇到,今天抽空看了一下.了解关于cursor pin S以及cursor pin S wait on X的相关问题,我看了一些链接: http://www.pythian.com/blog/cursor-pin-s-wait-on-x-in-the-top-5-wait-events/http:/

latch: row cache objects 和cursor: pin S wait on X共同出现

 Snap Id Snap Time Sessions Cursors/Session Begin Snap: 5980 11-Nov-13 16:00:37 1403  39.6 End Snap: 5981 11-Nov-13 16:31:29 1422  42.8 Elapsed:    30.86 (mins)    DB Time:    3,660.60 (mins)    Per Second Per Transaction Redo size:  1,185,514.75  6,

cursor: pin S wait on X等待事件模拟(转)

转自:http://warehouse.itpub.net/post/777/493962 这是10.2版本提出的mutex(互斥)机制用来解决library cache bin latch争夺问题引入的新事件,是否使用这种机制受到隐含参数_kks_use_mutex_pin的限制,从10.2.0.2开始该参数default为true,使用这种机制oracle是为了解决library cache bin latch的串行使用问题,但是mutex貌似还不是很稳定,在很多系统中会出现cursor:

为什么用 PostgreSQL 绑定变量 没有 Oracle pin S 等待问题

早上看到盖国强老师在朋友圈里分享了一篇关于软解析带来的Pin S等待的问题.有感而发,跟大家聊一聊为什么PostgreSQL不存在这个问题. Oracle 在Oracle中多个会话高并发的执行同一条SQL,如果使用了绑定变量的话,会产生pin s的等待事件.原因如下(取自互联网http://www.dbafree.net/?p=778) 每个child cursor(你可以认为是一条SQL的plan tree)下面都有一个mutexes这样的简单内存结构,当有session要执行该SQL而需要p

【MOS】常见问题cursor library cache类型的等待事件

[MOS]常见问题:'cursor:mutex ..'/ 'cursor:pin ..'/ 'library cache:mutex ..'类型的等待事件 (文档 ID 1525791.1) 文档内容 用途 问题和答案   什么是 'cursor: ' 等待事件?   最常见的等待事件是什么?   等待事件最常见的原因是什么?   如何避免这些等待事件?   可以在什么位置找到原因诊断以及关于这些等待事件的更多信息?   有用参考 参考 适用于: Oracle Database - Enterp

怎样诊断过去某个时间段的等待事件原因

1.查看某个等待事件的阻塞会话 select event,blocking_session,sql_id,count(*) from dba_hist_active_sess_history ash    where sample_time>=to_timestamp('2013-06-24 12:25:00','yyyy-mm-dd hh24:mi:ss')    and sample_time<=to_timestamp('2013-06-24 12:35:00','yyyy-mm-dd

oracle数据库library cache lock引发的一个问题解决办法

美女同事说某个客户有个问题,系统出现了大量的library cache lock. 导致业务严重受阻,具体表现是所有访问某个表的SQL语句都会挂起. 首先我们来看hanganalyze 的结果: PORADEBUG END ORIGINATING INST:1 SERIAL:0 PID:38076802 ******************************************************************** Found 341 objects waiting fo

kksfbc child completion与ksdxexeotherwait引发CPU使用异常

某客户操作人员反应很慢不能操作,管理人员登录小机系统后发现CPU使用到了96%.而且这种情况持续了几个月.以下是登录后小机后载取的topas图,而且是周末,并没有人使用系统.小机是IBM的550,配置是2颗6核的CPU,内存是48G. 如是登录数据库执行以下脚本来查看当前数据库消耗CPU最多的进程在执行什么 Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 Connected as gtp2 SQL> s