怎么发现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 288822D4
select * 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;

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

  1. 一次library cache pin故障的解决过程

    内容如下: 今天接到同事的电话,说他的一个存储过程已经run了一个多小时了,还在继续run,他觉得极不正常,按道理说不应该run这么长时间. 我说那我去看一下吧. 这个库是一个AIX上的10.2.0. ...

  2. 如何使用event 10049分析定位library cache lock and library cache pin

    Oracle Library Cache 的 lock 与 pin 说明 一. 相关的基本概念 之前整理了一篇blog,讲了Library Cache 的机制,参考: Oracle Library c ...

  3. DBA手记(学习)-library cache pin

    select sid,event,p1raw from v$session_wait where event like 'library cache pin%'; select sql_text fr ...

  4. 【翻译自mos文章】在11gR2 rac环境中,文件系统使用率紧张,而且lsof显示有非常多oraagent_oracle.l10 (deleted)

    在11gR2 rac环境中,文件系统使用率紧张.而且lsof显示有非常多oraagent_oracle.l10 (deleted) 參考原文: High Space Usage and "l ...

  5. 外键约束列并没有导致大量建筑指数library cache pin/library cache lock

    外键约束列并没有导致大量建筑指数library cache pin/library cache lock 清除一个100大数据表超过一百万线,发现已经运行了几个小时: delete B001.T_B1 ...

  6. Oracle单实例情况下的library cache pin的问题模拟与问题分析

    Oracle单实例情况下的library cache pin的问题模拟与问题分析 參考自: WAITEVENT: "library cache pin" Reference Not ...

  7. library cache pin解决方法

    library cache pin大部分都是因为编译存储过程造成的 查找造成问题的数据库对象(一般为存储过程) SELECT * FROM v$session_wait WHERE event = ' ...

  8. 深入理解shared pool共享池之library cache的library cache pin系列三

    关于library cache相关的LATCH非常多,名称差不多,我相信一些人对这些概念还是有些晕,我之前也有些晕,希望此文可以对这些概念有个更为清晰的理解,本文主要学习library cache p ...

  9. Resolving Issues of "Library Cache Pin" or "Cursor Pin S wait on X" (Doc ID 1476663.1)

    Doc ID 1476663.1) To Bottom In this Document   Purpose   Troubleshooting Steps   Brief Definition:   ...

随机推荐

  1. mysql high availability 概述

    一.什么是高可用性 1.可用性是指服务不间断运转的时间,通常用百分比来表示,例如 99.999%表示每年最多允许5分钟的宕机时间 2.可用性的效果和开销比例呈线性增长 3.可用性的意义往往也不尽相同, ...

  2. LINUX下 USB转串口 【转】

    转自:http://blog.163.com/smilexiao_11015461/blog/static/2122052182012102410399459/ 1.将设备u口插入pc2.输入#lsm ...

  3. 激活Window和office工具

    激活Window和office工具:    第一种工具(已使用工具激活microsoft office professional plus 2013版本):         暴风激活工具(暴风激活工具 ...

  4. stdole.dll

    迁移至win1064位后,发布提示stdole.dll错误,查找半天,是因为引用了office组件问题,将其注释掉.解决.因为此块代码无用,但是对有用的代码如何解决发布问题,未找到合适解决方法.

  5. Linux umount的device is busy问题

    现象: [root@dbserver ~]# df -h文件系统 容量 已用 可用 已用%% 挂载点/dev/vda1 9.9G 3.9G 5.6G 41% /tmpfs 3.9G 100K 3.9G ...

  6. 【转】如何使用MAT分析内存泄漏

    原文链接:http://www.lightskystreet.com/2015/09/01/mat_usage/ MAT - Memory Analyzer Tool 使用进阶 Sep 1, 2015 ...

  7. pom配置之:<distributionManagement>snapshot快照库和release发布库

    本文转载自:  铁木箱子的mzone的博客: http://www.mzone.cc/article/277.html http://www.mzone.cc/article/279.html 在使用 ...

  8. MVC Autofac依赖注入

    通过Dll实现全部类的属性注入,该演示实例主要通过多层架构中单一的对象方式来演示,没有采取接口的方式, 新建AutoFacHelper类,如下代码: public class AutoFacHelpe ...

  9. private,protected,public和default的区别

    private,protected,public和default的区别 private,protected,public和default作为Java中的访问修饰符,他们的最大区别就在于访问权限不同: ...

  10. Reactor模型-单线程版

    Reactor模型是典型的事件驱动模型.在网络编程中,所谓的事件当然就是read.write.bind.connect.close等这些动作了.Reactor模型的实现有很多种,下面介绍最基本的三种: ...