oracle library cache相關的等待事件及latch

wisdomone1發表於2013-04-23

Library cache中相關的latch包括:shared pool latch,
                                library cahce latch,
                                library cache lock latch,
                                library cache pin latch。

Share pool latch的主要作用是分配或釋放空間時使用,從Oracle9i開始,sharedpool被分成了很多個subpool,
由多個shared pool latch保護,Oracle開始支援更大的shared pool。

Library cache latch的主要作用是在hash bucket中定位handle時使用,

library cache lock latch和library cache pin latch分別是獲取lock和pin時,需要取得的latch。

shared pool大小不合理,大量的硬解析以及SQL版本過多都可能導致shared pool latch和library cache latch的爭用。

從Oracle10g開始,Oracle正在逐步用mutex取代library cache中的latch,
cursor:pin S和cursor:pin X相當於share和exclusive型別的library cache pin,
cursor:pin S wait on X則表示share方式正在等待exclusive鎖定。


/********與library cache相關的等待事件**********/
SQL> select * from v$event_name where name like '%library cache%';
 
    EVENT#   EVENT_ID NAME                           PARAMETER1                     PARAMETER2           PARAMETER3           WAIT_CLASS_ID  WAIT_CLASS
---------- ---------- ------------------------------ ------------------------------ -------------------- -------------------- -------------  --------------------
       280 2802704141 library cache pin              handle address                 pin address          100*mode+namespace      3875070507  Concurrency
       281  916468430 library cache lock             handle address                 lock address         100*mode+namespace      3875070507  Concurrency
       282 2952162927 library cache load lock        object address                 lock address         100*mask+namespace      3875070507  Concurrency
       283 1646780882 library cache: mutex X         idn                            value                where                   3875070507  Concurrency
       284 2446268751 library cache: mutex S         idn                            value                where                   3875070507  Concurrency
       815  800384622 library cache revalidation                                                                                 1893977003  Other
       816 1578286316 library cache shutdown                                                                                     1893977003  Other
 
7 rows selected

可知基本與併發訪問有關
 
 
 
 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-759138/,如需轉載,請註明出處,否則將追究法律責任。

相關文章