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


相关推荐

  • 数据库分区表关联

    数据库分区表关联数据库表分区场景: 现实业务中有两个表关系比较紧密,而且数据量比较大的时候,需要对两个表都进行分区,并能很好的发挥分表作用创建分区数据库表注意: 数据库表最好是在创建的时候就进行分区,不能对已经创建的普通表(堆表)再进行分区变为分区表,否则转换起来比较麻烦。createtableOCS_COLLECT_PEOPLE(COLLECT_IDV

    2022年5月3日
    53
  • 华硕路由器、LEDE、梅林,阿里DDNS教程

    华硕路由器、LEDE、梅林,阿里DDNS教程转自我的博客:sleele.com/2019/04/17/…教程华硕路由器官方固件,梅林,LEDE大体一致,下面我以华硕路由器官改固件为例展开教程首先安装阿里DDNS插件,在阿里注册一个域名,买最便宜的即可,购买域名后进入控制台设置域名解析按照图标顺序操作之后后让你输入手机验证码,之后就可以得到AccessKeyID、AccessKey…

    2022年6月11日
    83
  • windows批处理脚本_批处理打开文件命令

    windows批处理脚本_批处理打开文件命令 Windows平台批处理命令教程 do2jiang@gmail.com蒋冬冬 收集于网络 2009.4  该教程一共分为4大部分,第一部分是批处理的专用命令,第二部分是特殊的符号与批处理,第三部分是批处理与变量,第四部分是完整案例。 第一部分:批处理的专用命令 批处理文件是将一系列命令按一定的顺序集合为一个可执行的文本文件,其扩

    2022年8月22日
    8
  • 2014——我的求职(三)

    2014——我的求职(三)

    2022年1月9日
    30
  • java swing计算器_用winform编写计算器

    java swing计算器_用winform编写计算器实现要求1、使用Java图形界面组件设计软件,界面如图所示。2、软件能够满足基本的“加、减、乘、除”等运算要求。3、程序代码清晰,语法规范,结构合理,逻辑正确。4、编辑菜单中包括“复制和粘贴”两个菜单项,为菜单项编写事件代码。实现代码:importjava.awt.BorderLayout;importjava.awt.GridLayout;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;

    2022年9月17日
    2
  • 微博用户洞察_实现一个观察者模式

    微博用户洞察_实现一个观察者模式观察者模式:当对象间存在一对多关系时,则使用观察者模式(ObserverPattern)。比如,当一个对象被修改时,则会自动通知它的依赖对象。观察者模式属于行为型模式。观察者模式定义了对象间的一种

    2022年8月6日
    7

发表回复

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

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