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
How to trouble shooting Library cache lock/pin
2010/11/07 by Leave a Comment
Comment