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


相关推荐

  • 编码解码乱码字符集[通俗易懂]

    编码解码乱码字符集[通俗易懂]编码EnCode:将字符转化为字节解码DeCode:将字节转化为字符乱码:打个比方—比较多人知道的联通用字符集GBK的时候出现这样的情况:��ͨ,这就是乱码常见的中文字符集有:GBK和UTF-8国际上常用的字符集:Unicode(大字典)、ANSI UTF-8,中文占三个字节,英文占一个字节(变长),还有定长占两个字节(耗费空间多)GBK,中文占两个zijie…

    2022年5月30日
    41
  • VBA获取股票历史数据方法

    VBA获取股票历史数据方法Sub股票历史记录查询()Worksheets(“历史记录表”).Cells.Clear”输出结果表X=Application.CountA(Worksheets(“代码”).Range(“A:A”))”需要提取的股票代码Y=1Fori=2ToXdm=IIf(Worksheets(“代码”).Cells(i,1)<600000,…

    2022年6月24日
    46
  • PHP文件包含漏洞攻防实战(allow_url_fopen、open_basedir)

    PHP文件包含漏洞攻防实战(allow_url_fopen、open_basedir)摘要PHP是一种非常流行的Web开发语言,互联网上的许多Web应用都是利用PHP开发的。而在利用PHP开发的Web应用中,PHP文件包含漏洞是一种常见的漏洞。利用PHP文件包含漏洞入侵网站也是主流的

    2022年7月1日
    24
  • 微信小程序资源汇总

    微信小程序资源汇总微信小程序汇总(10月16日更新小程序100+个教程或资讯与50+个Demo)1:微信小程序官方工具:https://mp.weixin.qq.com/debug/w…tml?t=14764346784612:微信小程序简易教程:https://mp.weixin.qq.com/debug/wxadoc/dev/?t=14764346775993:微信小程序设计指南:http…

    2022年5月27日
    55
  • 机器学习之文本分类(附带训练集+数据集+所有代码)

    机器学习之文本分类(附带训练集+数据集+所有代码)我本次对4类文本进行分类((所有截图代码和数据集最后附带免费下载地址))主要步骤:1.各种读文件,写文件2.使用jieba分词将中文文本切割3.对处理之后的文本开始用TF-IDF算法进行单词权值的计算4.去掉停用词5.贝叶斯预测种类文本预处理:除去噪声,如:格式转换,去掉符号,整体规范化遍历的读取一个文件下的每个文本中文分词…

    2022年6月2日
    25
  • ThinkPHP实现定时执行任务的两种方法「建议收藏」

    ThinkPHP实现定时执行任务的两种方法「建议收藏」在平常的项目中我们总是会遇到需要将某个方法任务定时执行的问题,定时执行方法任务如果我们拥有服务器的权限,我们可以直接在服务器设置定时任务,例如在Windows的任务计划程序中进行设置,在Linux中编写脚本进行执行。如果我们没有服务器权限,我们该如何使用项目的程序代码来自动定时执行呢?接下来就为大家描述一个基于ThinkPHP框架定时执行任务的例子,具体的方法会在下面进行详细的描述。   

    2022年7月17日
    19

发表回复

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

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