Know More About Libarary Cache and Latches

简介:
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

本文转自maclean_007 51CTO博客,原文链接:http://blog.51cto.com/maclean/1276717


相关文章
|
缓存
cache
cache
83 0
|
内存技术
|
存储 SQL 缓存
|
存储 缓存
cache control 里 no-cache 和 no-store 的区别
cache control 里 no-cache 和 no-store 的区别
1008 0
|
缓存 NoSQL Redis
|
PHP 缓存
|
Java API Memcache
|
缓存 数据库
|
缓存 JavaScript 前端开发