Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1433968
  • 博文数量: 556
  • 博客积分: 12626
  • 博客等级: 上将
  • 技术积分: 5799
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-11 15:56
个人简介

从事IT基础架构多年,发现自己原来更合适去当老师……喜欢关注新鲜事物,不仅限于IT领域。

文章分类

全部博文(556)

文章存档

2019年(6)

2018年(15)

2017年(17)

2016年(11)

2015年(2)

2014年(2)

2013年(36)

2012年(54)

2011年(100)

2010年(41)

2009年(72)

2008年(14)

2007年(82)

2006年(104)

分类: Oracle

2006-04-15 16:47:33

"library cache pin" Reference Note

This is a reference note for the wait event "library cache pin" which includes the following subsections:
  • (eg: For waits seen in )
  • (eg: For waits seen in )
See for an introduction to Wait Events.

Definition:

  • Versions:7.0 - 9.2 Documentation:None
  • Library cache pins are used to manage library cache concurrency. Pinning an object causes the heaps to be loaded into memory (if not already loaded). PINS can be acquired in NULL, SHARE or EXCLUSIVE modes and can be considered like a special form of lock. A wait for a "library cache pin" implies some other session holds that PIN in an incompatible mode.

Individual Waits:

  Parameters:

  Wait Time:

The waiter waits up to 3 seconds (1 second if PMON) for the PIN to become available. If not available then the session waits again, incrementing SEQ# in .

  Finding Blockers:

The following SQL can be used to show the sessions which are holding and/or requesting pins on the object that given in P1 in the wait:
  SELECT s.sid, kglpnmod "Mode", kglpnreq "Req"
    FROM x$kglpn p, v$session s
   WHERE p.kglpnuse=s.saddr
     AND kglpnhdl='&P1RAW'
  ;
An X request (3) will be blocked by any pins held S mode (2) on the object.
An S request (2) will be blocked by any X mode (3) pin held, or may queue behind some other X request.

Diagnosis of why there is a blocking scenario will usually need help from Oracle support. If you just want to clear the immediate issue then the SID information above should allow you to kill off any blocking sessions. Proper diagnosis will usually require you to collect 3 SYSTEMSTATE dumps at 30 seconds intervals then submit these to Oracle support with full details of the sessions and objects involved. To take a SYSTEMSTATE dump connect to the instance a user with ALTER SYSTEM privilege and issue the command:

  ALTER SESSION SET max_dump_file_size = UNLIMITED;
  ALTER SYSTEM SET EVENTS 'immediate trace name systemstate level 10';
This will produce a trace file in USER_DUMP_DEST (or BACKGROUND_DUMP_DEST if connected to a shared server).
In a Parallel Server or RAC environment SYSTEMSTATE dumps should be taken 3 times on each node.

Systemwide Waits:

If "library cache pin" waits form a significant amount of the wait time then it is important to determine if this is one or two sessions waiting long periods of time or a more serious general contention issue among lots of processes.

Reducing Waits / Wait times:

What to do to reduce these waits depends heavily on what blocking scenario is occuring. A common problem scenario is the use of DYNAMIC SQL from within PLSQL procedure where the PLSQL code is recompiled and the DYNAMIC SQL calls something which depends on the calling procedure.
  • If there is general widespread waiting then the shared pool may need tuning. See .
  • If there is a blocking scenario collect evidence as described in above and contact Oracle support.

Related:

Tracing User sessions
Shared Pool Tuning

Important:

The above text makes reference to some X$ views. These are only visible to the SYS user and are not guaranteed to be available on all versions of Oracle. Customers are advised NOT to have any application code or scripts which rely on any X$ view.
阅读(1389) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~