怎么发现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. 永不改变的PCB设计黄金法则

    尽管目前半导体集成度越来越高,许多应用也都有随时可用的片上系统,同时许多功能强大且开箱即用的开发板也越来越可轻松获取,但许多使用案例中电子产品的应用仍然需要使用定制PCB.在一次性开发当中,即使一个普 ...

  2. 洛谷 P4389: 付公主的背包

    题目传送门:洛谷 P4389. 题意简述: 有 \(n\) 个物品,每个物品都有无限多,第 \(i\) 个物品的体积为 \(v_i\)(\(v_i\le m\)). 问用这些物品恰好装满容量为 \(i ...

  3. mac安装ocr

    mac安装Tesserocr 安装 Imagemagick 和 Tesseract 库: brew install imagemagick brew install tesseract --all-l ...

  4. java Socket和ServerSocket多线程编程

    这是在一本java教材上看到的,做了点修改.具体本教材记不清楚了,Sorry.放在这里,只是让自己需要的时候能够容易找到. 程序分两部分,服务端和客户端.先把服务端运行起来,在运行客户端.整个过程就是 ...

  5. Newtonsoft 反序列化字符串

    string json=“[{“name”:”zhangsan”,”age”:”12”},{“name”:”zhangsan”,”age”:”12”}]” 方法1: JArray arr = (JAr ...

  6. Ibatis.Net 表连接查询学习(五)

    IBatis.Net之多表查询 一.定制实际对应类的方式 首先配置多表的测试数据库,在之前Person表中增加一列"CountryId",新建一张Country表,两张表关系如下: ...

  7. findHomography和perspectiveTransform

    opencv中的两个函数,之前一直不明白这俩函数到底是要干嘛的. 得到两帧图像中的特征点后,就可以用findHomography得到单应性矩阵. 得到单应性矩阵后,可以 (1)根据相应的计算方法,由前 ...

  8. javaweb笔记五

    JSP:java server page服务器脚本语言.(脚本===插件),是一种在html代码中,嵌入java代码的方式.解决servlet产生动态页面缺陷而产生的一门技术.js:客户端脚本语言js ...

  9. Android多开/分身检测

    原文:https://blog.darkness463.top/2018/05/04/Android-Virtual-Check/ 多开/分身原本用于方便有多个微信/QQ解决同时登录的问题,但近来年被 ...

  10. Java 日期时间获取和显示

    Java正确获取星期Calendar.DAY_OF_WEEKhttp://chamcon.iteye.com/blog/2144433 Java SimpleDateFormat 中英文时间格式化转换 ...