Library cachepin (%)

本文详细解析了Oracle数据库中Library Cache Pin等待事件的管理与优化策略,包括其工作原理、指标总结、阈值设定、警报生成机制及解决方法。通过收集特定查询的数据,可以有效诊断并解决由该事件引发的性能瓶颈。

Library cachepin (%)

Description

Library cache pins are used to managelibrary cache concurrency. Pinning an object causes the heaps to be loaded intomemory (if not already loaded). PINS can be acquired in NULL, SHARE orEXCLUSIVE 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 anincompatible mode.

Metric Summary

The rest of the information in thissection is only valid for this metric when it appears in either the EnterpriseManager Grid Control or the Enterprise Manager Database Control (ifapplicable).

The following table shows how often themetric's value is collected and compared against the default thresholds. The'Consecutive Number of Occurrences Preceding Notification' column indicates theconsecutive number of times the comparison against thresholds should hold TRUEbefore an alert is generated.

Target Version

Evaluation and Collection Frequency

Upload Frequency

Operator

Default Warning Threshold

Default Critical Threshold

Consecutive Number of Occurrences Preceding Notification

Alert Text

pre-10g

Every Minute

After Every Sample

20

Not Defined

3

%value%%% of service time is spent waiting on the 'library cache pin' event.

Data Source

(DeltaLibraryCachePinTime/DeltaServiceTime)*100where:

  • DeltaLibraryCachePinTime: difference of 'sum of time waited for sessions of foreground processes on the 'library cache pin' event' between sample end and start
  • DeltaServiceTime: difference of 'sum of time waited for sessions of foreground processes on events not in IdleEvents + sum of 'CPU used when call started' for sessions of foreground processes' between sample end and start

See Idle Events

User Action

What to do to reduce these waits dependsheavily on what blocking scenario is occurring. A common problem scenario isthe use of DYNAMIC SQL from within a PL/SQL procedure where the PL/SQL code isrecompiled and the DYNAMIC SQL calls something which depends on the callingprocedure.

  • If there is general widespread waiting then the shared pool may need tuning.
  • If there is a blocking scenario, collect evidence as described in the following query and contact Oracle support.

The following query will list the waitersand the session holding the pin, along with the wait event the holder iswaiting for.

column h_wait format A20

SELECT s.sid,

   waiter.p1raw w_p1r,

   holder.event h_wait,

   holder.p1raw h_p1r,

   holder.p2raw h_p2r,

   holder.p3raw h_p2r,

   count(s.sid) users_blocked,

   sql.hash_value

FROM

   v$sql sql,

    v$session s,

   x$kglpn p,

   v$session_wait waiter,

   v$session_wait holder

WHERE

   s.sql_hash_value = sql.hash_value and

   p.kglpnhdl=waiter.p1raw and

   s.saddr=p.kglpnuse and

   waiter.event like 'library cache pin' and

   holder.sid=s.sid

GROUP BY

   s.sid,

   waiter.p1raw ,

   holder.event ,

   holder.p1raw ,

   holder.p2raw ,

   holder.p3raw ,

   sql.hash_value

;

Related Topics

About Alerts

About the Metric Detail Page

Editing Thresholds

Understanding Line Charts

Copyright © 1996, 2009, Oracle and/or itsaffiliates. All rights reserved. 
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. 
Other names may be trademarks of their respective owners.

在这个情况下,"impdp library cache pin"是指在使用impdp命令导入数据时,出现了"library cache pin"等待事件。\[2\] "library cache pin"事件是用来管理library cache的并发访问的,当一个session需要修改或检测一个object时,它必须在锁住后取得一个pin。\[2\] 在这个具体的案例中,当执行impdp命令导入数据时,发现所有的DW会话都在等待"library cache lock",并且其中一个session阻塞了自身,形成了一个死锁。\[3\] 这个问题的原因是之前有一次impdp中途终止,再次执行impdp时使用了TABLE_EXISTS_ACTION=REPLACE选项,但是在创建一个TYPE时,另一个TYPE依赖于它,导致无法替换这个TYPE,从而引发了死锁。\[3\] 解决这个问题的办法是先将相关的SCHEMA B删除,然后重新执行impdp命令。这样可以解除死锁并成功导入数据。\[3\] #### 引用[.reference_title] - *1* [一次library cache pin故障的解决过程](https://blog.youkuaiyun.com/conglueh193642/article/details/100469095)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [解决library cache pin等待事件](https://blog.youkuaiyun.com/weixin_28996271/article/details/116441997)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [impdp时卡住,DW等待library cache lock](https://blog.youkuaiyun.com/zhou1862324/article/details/46746561)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值