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

參考自:

WAITEVENT: "library cache pin" Reference Note (文档 ID 34579.1)

How to Find the Blocker of the 'library cache pin' in a RAC environment? (文档 ID 780514.1)

本机环境:Oracle 10.2.0.5 x86-64bit for RHEL5.8 x86-64bit

第一个session:

  1. [oracle@localhost ~]$ sqlplus / as sysdba
  2.  
  3. SQL*Plus: Release 10.2.0.5.0 - Production on Fri Jun 12 17:27:28 2015
  4.  
  5. Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
  6.  
  7. Connected to an idle instance.
  8.  
  9. SQL> startup
  10.  
  11. ORACLE instance started.
  12.  
  13. Total System Global Area 281018368 bytes
  14. Fixed Size 2095672 bytes
  15. Variable Size 96470472 bytes
  16. Database Buffers 176160768 bytes
  17. Redo Buffers 6291456 bytes
  18. Database mounted.
  19. Database opened.
  20.  
  21. SQL> create user lc0019999 identified by aaaaaa;
  22.  
  23. User created.
  24.  
  25. SQL> grant dba to lc0019999;
  26.  
  27. Grant succeeded.
  28.  
  29. SQL> create user lc0029999 identified by aaaaaa;
  30.  
  31. User created.
  32.  
  33. SQL> grant dba to lc0029999;
  34.  
  35. Grant succeeded.
  36.  
  37. SQL> create user lc0039999 identified by aaaaaa;
  38.  
  39. User created.
  40.  
  41. SQL> grant dba to lc0039999;
  42.  
  43. Grant succeeded.
  44.  
  45. SQL> conn lc0019999/aaaaaa
  46. Connected.
  47. SQL> show user
  48. USER is "LC0019999"
  49.  
  50. SQL> select * from v$mystat where rownum<2;
  51.  
  52. SID STATISTIC# VALUE
  53. ---------- ---------- ----------
  54. 159 0 1
  55.  
  56. SQL> Create or replace procedure dummy is
  57. 2 begin
  58. 3 null;
  59. 4 end;
  60. 5 /
  61.  
  62. Procedure created.
  63.  
  64. SQL> Begin
  65. 2 Dummy;
  66. 3 Dbms_lock.sleep(1000);
  67. 4 End;
  68. 5 /
  69. ------------>一直sleep

以lc0029999登陆新开的一个session

  1. [oracle@localhost ~]$ sqlplus lc0029999/aaaaaa
  2.  
  3. SQL*Plus: Release 10.2.0.5.0 - Production on Fri Jun 12 17:34:04 2015
  4.  
  5. Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
  6.  
  7. Connected to:
  8. Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
  9. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  10.  
  11. SQL> select * from v$mystat where rownum<2;
  12.  
  13. SID STATISTIC# VALUE
  14. ---------- ---------- ----------
  15. 158 0 1
  16.  
  17. SQL>
  18. SQL> alter procedure lc0019999.dummy compile;
  19.  
  20. ------------>一直hang

以sys用户新开一个session

  1. [oracle@localhost ~]$ sqlplus / as sysdba
  2.  
  3. SQL*Plus: Release 10.2.0.5.0 - Production on Fri Jun 12 17:31:33 2015
  4.  
  5. Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
  6.  
  7. Connected to:
  8. Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
  9. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  10.  
  11. SQL> set line 200
  12. SQL> select sid, serial#,event from v$session where event like '%library cache pin%';
  13.  
  14. SID SERIAL# EVENT
  15. ---------- ---------- ----------------------------------------------------------------
  16. 158 28 library cache pin
  17.  
  18. SQL> select sid, serial#,p1raw,event from v$session where event like '%library cache pin%';
  19.  
  20. SID SERIAL# P1RAW EVENT
  21. ---------- ---------- ---------------- --------------------------------------------------
  22. 158 28 000000006BFF19B0 library cache pin
  23.  
  24. SQL> col owner for a30
  25. SQL> col object for a30
  26. SQL> SELECT kglnaown "Owner", kglnaobj "Object"
  27. 2 FROM x$kglob
  28. 3 WHERE kglhdadr='000000006BFF19B0'---->上面查出的P1RAW值。
  29.  
  30. 4 ; ---->该语句是查询出这个等待事件发生在哪个object上。
  31.  
  32. Owner Object
  33. ------------------------------ ------------------------------
  34. LC0019999 DUMMY
  35.  
  36. SQL>
  37. SQL> SELECT s.sid, kglpnmod "Mode", kglpnreq "Req"
  38. 2 FROM x$kglpn p, v$session s
  39. 3 WHERE p.kglpnuse=s.saddr
  40. 4 AND kglpnhdl='000000006BFF19B0';---->该语句是查询出这个等待事件的等待者sidREQ>0)和持有者sidMode>0
  41.  
  42. SID Mode Req
  43. ---------- ---------- ----------
  44. 158 0 3
  45. 159 2 0
  46.  
  47. SQL>
  48. ---补充:例如以下文字来源于:
  49. <blockquote><strong><code>Mode</code></strong><span> </span>is the mode in which the pin is wanted. This is a number thus:<ul><li>2 - Share mode</li><li>3 - Exclusive mode</li></ul></blockquote>
  1. 例如以下摘自:WAITEVENT: "library cache pin" Reference Note (文档 ID 34579.1)
  2. An X request (3) will be blocked by any pins held S mode (2) on the object.
  3. An S request (2) will be blocked by any X mode (3) pin held, or may queue behind some other X request.

Oracle单实例情况下的library cache pin的问题模拟与问题分析的更多相关文章

  1. Oracle内存详解之二 Library cache 库缓冲-转载

    Library cache是Shared pool的一部分,它几乎是Oracle内存结构中最复杂的一部分,主要存放shared curosr(SQL)和PLSQL对象(function,procedu ...

  2. oracle 单实例DG(搭建篇一)

    一,介绍 lodding... 二,安装前环境配置 01,依赖包的安装: yum install binutils-* yum install compat-libstdc++-* yum insta ...

  3. Oracle 单实例数据库安装和real application clusters数据库安装的区别

    在想了解Oracle单实例数据可和RAC数据库前,请确保你已经知道了数据库和实例的关系,如果不了解,请参考Oracle 数据库实例和数据库. 单实例数据库模式 单实例模式下,一个数据库只能通过一个实例 ...

  4. Oracle Study之--Oracle 单实例11.2.0.1.0升级到11.2.0.3.0

    Oracle Study之--Oracle 单实例11.2.0.1.0升级到11.2.0.3.0 系统环境: 操作系统:RedHat EL6(64位) Oracle:    Oracle 11gR2 ...

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

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

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

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

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

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

  8. 怎么发现RAC环境中&#39;library cache pin&#39;等待事件的堵塞者(Blocker)?

    怎么发现RAC环境中的'library cache pin'等待事件的堵塞者(Blocker) 參考自 How to Find the Blocker of the 'library cache pi ...

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

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

随机推荐

  1. mysql linux查看配置文件my.cnf位置

    原文:mysql linux查看配置文件my.cnf位置 命令: mysql --help | grep 'Default options' -A 1

  2. 【codeforces 743E】Vladik and cards

    [题目链接]:http://codeforces.com/problemset/problem/743/E [题意] 给你n个数字; 这些数字都是1到8范围内的整数; 然后让你从中选出一个最长的子列; ...

  3. Nodejs之旅開始

    web前端是一个门槛低,但精通起来比較难的行业,由于它涉及的范围比較广,也许在十年前.我光靠切图,就能找到一个好的职位,可是如今,仅仅会切图.我们非常难找到自己惬意的工作,如今前端职位要求不仅是htm ...

  4. Android中通过ViewHelper.setTranslationY实现View移动控制(NineOldAndroids开源项目)

    我们知道有不少开源project,能实现非常多不错的效果.前几天,我看了一个效果,刚好项目中也用到了这个jar包. 没事挖一挖 学一学(一说到挖一挖.那么问题来了.挖掘机技术究竟哪家强 ),看看不错的 ...

  5. UnityShader实例13:屏幕特效之均值模糊(Box Blur)

    均值模糊(Box Blur) 概述 因为公司手游项目需求.须要一个适合手机平台的模糊效果,同一时候须要开放一个參数便于调节模糊值.我首先想到的就是ps里面的均值模糊. 查资料能够知道均值模糊是一种高速 ...

  6. vargrind 安卓apk

    上层为安卓, 下层为调用c/c++ 库 1.将vargind 按官网方法下载源代码编译  得Inst文件夹 2.通过win 下安卓sdk 中 platform-tools 中的adb push Ins ...

  7. RandomAccessFile操作文件

    package file; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; ...

  8. 修改DNS

    解决方案一: 修改/etc/resolv.conf,添加 nameserver 8.8.8.8 nameserver 8.8.4.4 然后停用NetworkManager,service Networ ...

  9. BZOJ 2844 高斯消元 线性基

    思路: //By SiriusRen #include <cstdio> #include <cstring> #include <algorithm> using ...

  10. Bringing up the Avnet MicroZed with Vivado

    Bringing up the Avnet MicroZed with Vivado I recently received the Adam Taylor Edition of Avnet's Zy ...