Stored objects And Transient objects are stored in the library cache, neither Temporary objects nor Permanent objects.
The library cache is structured as a Hash table .But Library cache objects are composed of data heaps.
Oracle access hash tables through hash buckets.
SHARED_POOL_SIZE does the Oracle server determine the number of hash tables. When the the shared pool is larger, it can accommodate more object handles.
_KGL_BUCKET_CNT can be used to set the number of hash buckets and deprecated.
The minimum size of the hash table is 509 buckets in ORACLE 7.
For performance reasons, when the linked list has an average depth of 2 the Oracle server doubles the size of the hash table.
Locks manage concurrency whereas pins manage cache coherency.
There are two valid library cache pin modes: Share and Exclusive
An object handle is protected by a latch determined by the bucket it hashes into using the formula latch# = mod(bucket#, #latches) .
The hidden parameter _KGL_LATCH_COUNT is used to determine the number of child latches.”The default value should be adequate, but if contention for the library cache latch cant be resolved, it may be advisable to increase this value. The default value for _KGL_LATCH_COUNT is the next prime number after CPU_COUNT. This value cannot exceed 66 (See: <>). ”
Begin 10.2.0.2, mutex take place cursor pin latch.To avoid using Mutex latches, you can set _kks_use_mutex_pin=false .
CURSOR_SPACE_FOR_TIME has been deprecated in 10.2.0.5 and 11.1.0.7.
CURSOR_SPACE_FOR_TIME was originally introduced to try and help reduce latch contention by keeping cursors in memory in the SGA rather than allowing their data to be flushed from the shared pool. Such latch contention is avoided in current releases by the use of cursor mutexes and so this parameter is no longer relevant.
v$open_cursor lists kinds of library cache lock,x$kgllk – Details about Object locks
v$open_cursor select inst_id, kgllkuse, kgllksnm, user_name, kglhdpar, kglnahsh, kgllksqlid, kglnaobj, kgllkest, decode(kgllkexc, 0, to_number(NULL), kgllkexc), kgllkctp from x$kgllk where kglhdnsp = 0 and kglhdpar != kgllkhdl SQL> select distinct kgllkctp from x$kgllk ; KGLLKCTP -------------------------------------------- SESSION CURSOR CACHED PL/SQL CURSOR CACHED OPEN OPEN-RECURSIVE DICTIONARY LOOKUP CURSOR CACHED
What are Latches and What Causes Latch Contention
From the Tracefile:
– process 4 MMAN is holding the SHARED POOL LATCH
– process 5 DBWO is waiting for SHARED POOL LATCH as hold by process 4
– process 27 OWB Runtime Service is holding CHILD LIBRARY CACHE LATCH
– process 27 OWB Runtime Service is waiting for SHARED POOL LATCH as hold by
process 4
– process 10 CJQ0 is waiting for CHILD LIBRARY CACHE LATCH as hold by process
27
So problem occured at moment that process 4 tried to grab CHILD LIBRARY CACHE
LATCH while holding the SHARED POOL LATCH.