zoukankan      html  css  js  c++  java
  • How to trouble shooting Library cache lock/pin

    1.Troubleshooting Library Cache: Lock, Pin and Load Lock (Doc ID 444560.1)
    What is "Library cache lock" ?
    
    This event controls the concurrency between clients of the library cache. It acquires a lock on
    the object handle so that either:
    
    * One client can prevent other clients from accessing the same object.
    
    * The client can maintain a dependency for a long time (for example, so that no other client can change the object).
    
    This lock is also obtained to locate an object in the library cache.
    Library cache lock will be obtained on database objects referenced during parsing or compiling of
    SQL or PL/SQL statements (table, view, procedure, function, package, package body, trigger, index, cluster, synonym).
    The lock will be released at the end of the parse or compilation.
    
    Cursors (SQL and PL/SQL areas), pipes and any other transient objects do not use this lock.
    Library cache lock is not deadlock sensitive and the operation is synchronous.
    
    Parameters:
    
    * handle address
    Address of the object being loaded.
    
    * lock address
    Address of the load lock being used. This is not the same thing as a latch or an enqueue, it is a State Object.
    
    * Mode
    Indicates the data pieces of the object which need to be loaded.
    
    * Namespace
    The name of the object namespace as it is displayed in V$DB_OBJECT_CACHE view
    
    How can Library cache lock be reduced?
    
    In general , high contention on library cache lock is usually a result of an under-sized shared pool or
    non-sharing of sql. Some ways of reducing the contention are:
    
    * Reduce the reloads by increasing the shared pool size as the locks may take a long time if the pool is undersized.
    
    * Increase sharing by setting the cursor_sharing to similar or force.
    Be aware this may change the execution plan; so setting the parameter should be thoroughly tested.
    
    * Reduce the invalidations by running the batch jobs to collect statistics or any other maintenance jobs
    separately from OLTP.
    
    Note 122793.1 How to Find which Session is Holding a Particular Library Cache Lock
    
    Known Bugs:
    
    Note:10018789.8Spin in kgllock / DB hang with high library cache lock waits
    Note:7423411.8Process may hang waiting for "library cache load lock" with no holder
    Note:7706138.8Process may hang waiting for "library cache load lock" with no holder
    Note:9675816.8Bug 9675816 - Self deadlock with 'library cache lock' waits
    
    2.How to Find which Session is Holding a Particular Library Cache Lock (Doc ID 122793.1)
    
    Method 1: Systemstate Analysis
    
    For older versions you can use the following syntax that is also possible in higher versions.The level 266 is
    not available before 9.2.0.6
    
    alter session set max_dump_file_size=unlimited;
    alter session set events 'immediate trace name systemstate level 10'
    Oracle will create a systemstate tracefile in your USER_DUMP_DEST directory.
    
    METHOD 2: EXAMINE THE X$KGLLK TABLE
    select sid,saddr from v$session where event= 'library cache lock';
    
    SID SADDR
    ---------- --------
    16 572ed244
    
    select kgllkhdl Handle,kgllkreq Request, kglnaobj Object
    from x$kgllk where kgllkses = '572ed244'
    and kgllkreq > 0;
    
    HANDLE REQUEST OBJECT
    -------- ---------- ------------------------------------------------------------
    62d064dc 2 EMPLOYEES
    
    A:It's possible that one library cache lock can block all the other sessions if this table need to be
    queried by other sessions.
    
    The problem is why the library cache lock was held for so long and wasn't released.
    Usually, library cache lock only cost a few milliseconds.
    
    It could be these Known Bugs:
    
    Note:10018789.8 Spin in kgllock / DB hang with high library cache lock waits
    Note:7423411.8 Process may hang waiting for "library cache load lock" with no holder
    Note:7706138.8 Process may hang waiting for "library cache load lock" with no holder
    Note:9675816.8 Bug 9675816 - Self deadlock with 'library cache lock' waits
    
    For more information, you can refer note 444560.1 and 122793.1.
    
    To understand the root cause, we need more information to analyze.
    You may take systemstate and hanganalyze next time and we'll help you to analyze them.
    
    1. Please generate systemstate dump as sysdba:
    SQL>conn / as sysdba;
    SQL>alter session set max_dump_file_size = unlimited;
    SQL>alter session set events 'immediate trace name systemstate level 10';
    Wait for some some seconds
    SQL>alter session set events 'immediate trace name systemstate level 10';
    Wait for some some seconds
    SQL>alter session set events 'immediate trace name systemstate level 10';
    
    2. Open another session as sysdba:
    SQL>conn / as sysdba;
    SQL>oradebug setmypid
    SQL>oradebug unlimit;
    SQL>oradebug dump hanganalyze 3
    Wait for some seconds
    SQL>oradebug dump hanganalyze 3
    Wait for some seconds
    SQL>oradebug dump hanganalyze 3
    
    3. The generated files will be under udump. Please upload these files.
    $cd udump
    $ls –ltr
  • 相关阅读:
    csp-s 92
    支持smtp/imap smtp/pop3的撞库python撞库脚本
    关于KB2839299 微软补丁前后的kifastcallentry
    (转载)RegSetValueEx设置REG_SZ类型键值时要注意的问题
    x64windows安全机制进程_线程_模块加载回调摘要
    windbg脚本实践3----监控特定进程创建
    windbg脚本实践2----监控特定注册表键值创建和删除
    windbg脚本实践1----监控特定文件创建 删除 读写
    纪念在乙方安全公司的2年_关于杀毒软件和远控的斗争
    文件删除的windows下面的三种路径(轻量级)
  • 原文地址:https://www.cnblogs.com/macleanoracle/p/2967593.html
Copyright © 2011-2022 走看看