怎么发现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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • xmind打不开xmind文件_鼠标双击无法打开文件

    xmind打不开xmind文件_鼠标双击无法打开文件声明:请大家支持正版!此文仅作个人交流学习!很多小伙伴安装完Xmind后会发现双击无法打开文件,只能在应用界面打开,我在网上也看了很多解决方案,但是很多都是没用的,比如这个:还有说把最大支持的文件大小改成128m,亲测没用。还有想着把pojie包配置给注释掉的,这种可能也是为了支持正版吧/手动狗头后来试了很多方法,发现更改一下pojie包的路径就好了,改成绝对路径就可以直接打开。我用的是xmind8update9版本,亲测可行,如果其他版本的小伙伴试了不行的话,可以评论区一起交流一下~..

    2022年10月24日
  • java8 reduce的用法_Java 8系列之Stream中万能的reduce用法说明

    java8 reduce的用法_Java 8系列之Stream中万能的reduce用法说明reduce操作可以实现从Stream中生成一个值,其生成的值不是随意的,而是根据指定的计算模型。比如,之前提到count、min和max方法,因为常用而被纳入标准库中。事实上,这些方法都是reduce操作。reduce方法有三个override的方法:Optionalreduce(BinaryOperatoraccumulator);Treduce(Tidentity,BinaryO…

    2022年10月31日
  • 协同过滤推荐算法(一)原理与实现

    协同过滤推荐算法(一)原理与实现一、协同过滤算法原理协同过滤推荐算法是诞生最早,并且较为著名的推荐算法。主要的功能是预测和推荐。算法通过对用户历史行为数据的挖掘发现用户的偏好,基于不同的偏好对用户进行群组划分并推荐品味相似的商品。协同过滤推荐算法分为两类,分别是基于用户的协同过滤算法(user-basedcollaboratIvefiltering),和基于物品的协同过滤算法(item-basedcollaborati…

    2022年6月24日
  • kl散度和交叉熵的区别_散度的概念

    kl散度和交叉熵的区别_散度的概念通用的说,熵(Entropy)被用于描述一个系统中的不确定性(theuncertaintyofasystem)。在不同领域熵有不同的解释,比如热力学的定义和信息论也不大相同。要想明白交叉熵(CrossEntropy)的意义,可以从熵(Entropy)->KL散度(Kullback-LeiblerDivergence)->交叉熵这个顺序入手。当然,也有多种解释方法…

    2022年10月23日
  • 应用程序启动速度的优化

    应用程序启动速度的优化

    2022年1月15日
  • js中判断对象是否为空

    js中判断对象是否为空1.es6中可以使用Object.keys(obj)vardata={};vararr=Object.keys(data);alert(arr.length==0);//true为空,false不为空2.将json对象转化为json字符串,再判断该字符串是否为"{}"vardata={};varb=(JSON.stringify(data)==…

    2022年6月14日

发表回复

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

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