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


相关推荐

  • 随机森林算法通俗易懂(改进的随机森林算法)

        1)决策树    2)随机森林    4)OutofBag评价    3)随机森林的应用计算特征重要性异常值检测——IsolationForest计算样本的相似度 …

    2022年4月15日
    142
  • Zynq 7020 学习心得【1】

    Zynq 7020 学习心得【1】今天对照Miz702的板子,学习了EMIO的用法,遇到了一点问题,经过分析和尝试,解决了,写出来,给大家参考一下。第一个问题,约束文件报warning,并且生成bitstream出错。开发板教程中

    2022年8月5日
    6
  • Idea激活码最新教程2024.3版本,永久有效激活码,亲测可用,记得收藏

    Idea激活码最新教程2024.3版本,永久有效激活码,亲测可用,记得收藏Idea 激活码教程永久有效 2024 3 激活码教程 Windows 版永久激活 持续更新 Idea 激活码 2024 3 成功激活

    2025年5月31日
    9
  • 【Vue】关闭 eslint 检测「建议收藏」

    【Vue】关闭 eslint 检测「建议收藏」eslint是一个JavaScript的校验插件,通常用来校验语法或代码的书写风格。

    2022年10月8日
    2
  • SSH学习(一)—— 基础概念篇

    SSH学习(一)—— 基础概念篇一、前言最近有个小面试需要复习以前用到的SSH框架,忘得差不多了当然当时也差不多就是不会的状态,现在花了三四天的时间进行一个简单的学习,总结一些概念性的东西放在这儿。二、参考链接ssh框架:https://baike.baidu.com/item/ssh%E6%A1%86%E6%9E%B6/8882453?fr=aladdinSSH三大框架的概述:https://blog.csdn…

    2022年6月24日
    30
  • 什么是404页面,如何正确设置制作404页面

    什么是404页面,如何正确设置制作404页面
    什么是404页面?
      404网页是用户尝试访问网站不存在的网页(由于用户点击了损坏的链接、网页已被删除或用户输入了错误的网址)时看到的页面。之所以称为404网页,是因为针对丢失网页的请求,网络服务器会返回404HTTP状态代码,表明该网页未找到。
    404页面的目的是:告诉浏览者其所请求的页面不存在或链接错误,同时引导用户使用网站其他页面而不是关闭窗口离开。
    404对搜索引擎优化seo的影响
      搜索引擎通过HTTP状态码来识别网页的状态。当

    2022年7月27日
    13

发表回复

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

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