怎么发现RAC环境中'library cache pin'等待事件的堵塞者(Blocker)?「建议收藏」

怎么发现RAC环境中'library cache pin'等待事件的堵塞者(Blocker)?

大家好,又见面了,我是全栈君。

怎么发现RAC环境中的’library cache pin’等待事件的堵塞者(Blocker)

參考自
How to Find the Blocker of the ‘library cache pin’ in a RAC environment? (文档 ID 780514.1)

本文不做翻译。全文转载:

Applies to:

Oracle Database – Enterprise Edition – Version 9.2.0.1 to 11.1.0.7 [Release 9.2 to 11.1]
Information  in this document applies to any platform.
Add ***Checked for relevance on 15-Dec-2010***

Goal

The goal of this note is to explain how to understand who is blocking a ‘library cache pin’ in a RAC environment

Fix

a. introduction

V$SESSION blocking fields can’t be used for library cache locks/pins.

Note:169139.1 explains how to diagnose library cache locks/pin in single instance systems. The pin/lock handles are however different on each database instance. So, the pin/lock handle of the  DBA_KGLLOCK can’t be used with a  RAC database and view DBA_KGLLOCK can just be used to locate waiting sessions.

Note:34579.1 can then be used to locate the object locked (via the x$kglob query) on some other instances.

Once you have the object locked, you can query  each instance and drill down the opposite way
to know who is holding a pin on that object via instance views X$KGLOB to get the local instance KGLHDADR => then v$session/DBA_KGLLOCK.

2. scenario example

Scenario to simulate a ‘library cache pin’ problem

a. Session 1 on instance1: Create a dummy procedure:

Create or replace procedure dummy is
begin
null;
end;
/

b. Session 1 on instance1: Execute the above procedure in a PL/SQL block to block the dummy

Begin
Dummy;
Dbms_lock.sleep(1000);
End;
/

3. Session 2 on instance2: Compile the  the above procedure.

alter procedure dummy compile;

=> session 2 will be blocked in 'library cache pin'.


3. How to find the blocker


a. find the p1raw value of the ‘library cache pin’, e.g.

 
select sid, event, p1raw from v$session_wait where event = 'library cache pin';SID EVENT             P1RAW--- ----------------- --------150 library cache pin 288822D4select * from dba_kgllock where kgllkreq > 0;KGLLKUSE KGLLKHDL KGLLKMOD KGLLKREQ KGLL-------- -------- -------- -------- ----2CB1F978 288822D4        0        3 Pin

 

2. find the locked object via x$kglob, e.g.

select kglnaown, kglnaobj from x$kglob where kglhdadr = '288822D4';
KGLNAOWN KGLNAOBJ
-------- --------
SYS      DUMMY

3. find the kglhdadr in the other instances, e.g.—>这是在其它的实例上运行。

select kglhdadr, kglnaown, kglnaobj from x$kglob where kglnaobj = 'DUMMY';
KGLHDADR KGLNAOWN KGLNAOBJ
-------- -------- --------
28577AD8 SYS      DUMMY

4. find the blocking session on the remote instance, e.g.—>这是在其它的实例上运行。

select sid, serial#, sql_text from dba_kgllock w, v$session s, v$sqlarea a
where w.kgllkuse = s.saddr and w.kgllkhdl='28577AD8'
and s.sql_address = a.address
and s.sql_hash_value = a.hash_value;
SID SERIAL# SQL_TEXT
--- ------- ---------------------------------------
155    939  begin dummy; dbms_lock.sleep(1000); end;

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/115244.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 通达OA 小飞鱼开发培训第四讲 工作流介绍(图文)[通俗易懂]

    通达OA 小飞鱼开发培训第四讲 工作流介绍(图文)

    2022年1月27日
    52
  • Postman 汉化(Postman中文版)

    Postman 汉化(Postman中文版)postman官网下载地址https://www.postman.com/downloads/postman汉化包https://github.com/hlmd/Postman-cn/releases1.首先从官网下载postMan安装包2.下载postMan汉化包(app.zip)3.将汉化包解压并复制到Postman目录下4.重启postMan即可完成汉化…

    2025年8月7日
    3
  • 浅谈Vue.js_Vue js quote

    浅谈Vue.js_Vue js quote作为一名Vue.js的忠实用户,我想有必要写点文章来歌颂这一门美好的语言了,我给它的总体评价是“简单却不失优雅,小巧而不乏大匠”,下面将围绕这句话给大家介绍Vue.js,希望能够激发你对Vue.js的

    2022年8月1日
    8
  • 存算一体——后摩尔时代的AI芯片架构[通俗易懂]

    存算一体——后摩尔时代的AI芯片架构[通俗易懂]存算一体,或存内计算,是指将传统冯诺依曼架构中以计算为中心的设计,转变为以数据存储为中心的设计,也就是利用存储器对数据进行运算,从而避免数据搬运产生的“存储墙”和“功耗墙”,极大提高数据的并行度和能量效率。这种架构特别适用于要求大算力、低功耗的终端设备,如可穿戴设备、移动设备、智能家居等。1.冯诺依曼架构的局限首先是性能。经典的冯诺依曼架构下,数据的存储和计算是分开的,处理器CPU存储器之间通过数据总线进行数据交换。但由于处理器和存储器的内部结构、工艺和封装不同,二者的性能也存在很大的差.

    2025年9月26日
    15
  • intellijidea激活码(最新序列号破解)

    intellijidea激活码(最新序列号破解),https://javaforall.net/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

    2022年3月18日
    171
  • Rectified Linear Unit_激活函数图像

    Rectified Linear Unit_激活函数图像传统Sigmoid系激活函数传统神经网络中最常用的两个激活函数,Sigmoid系(Logistic-Sigmoid、Tanh-Sigmoid)被视为神经网络的核心所在。从数学上来看,非线性的Sigmoid函数对中央区的信号增益较大,对两侧区的信号增益小,在信号的特征空间映射上,有很好的效果。从神经科学上来看,中央区酷似神经元的兴奋态,两侧区酷似神经元的抑制态,因而在

    2025年6月30日
    3

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号