在10g中,latch free 等待事件被进一步细化成各种具体的latch,但在观察等待事件时,发现仍然有'latch free'这个等待事件,那么这个'latch free'等待具体包含了哪些latch的等待呢?
先看一下v$event_name中关于相关latch free等待事件的定义:
SQL> select event#,name from v$event_name where name like 'latch:%' or name='latch free';
EVENT# NAME
---------- ----------------------------------------------------------------
59 latch: cache buffers chains
107 latch: redo writing
108 latch: redo copy
194 latch: Undo Hint Latch
196 latch: In memory undo latch
197 latch: MQL Tracking Latch
207 latch: row cache objects
213 latch: shared pool
214 latch: library cache
215 latch: library cache lock
216 latch: library cache pin
293 latch free
302 latch: session allocation
317 latch: messages
320 latch: enqueue hash chains
348 latch: ges resource hash list
401 latch: gcs resource hash
432 latch: cache buffers lru chain
434 latch: checkpoint queue latch
435 latch: cache buffer handles
445 latch: object queue header operation
446 latch: object queue header heap
490 latch: redo allocation
501 latch: KCL gc element parent latch
571 latch: undo global data
595 latch: Change Notification Hash table latch
644 latch: virtual circuit queues
673 latch: parallel query alloc buffer
28 rows selected.
可以看出,'latch free'仍然是其中的一个等待事件,再查看v$latch视图中相关latch的信息:
SQL> select name from v$latch where name in (select substr(name,8) from v$event_name where name like 'latch:%');
NAME
--------------------------------------------------
cache buffer handles
checkpoint queue latch
redo copy
library cache pin
object queue header heap
redo allocation
session allocation
gcs resource hash
cache buffers lru chain
Undo Hint Latch
In memory undo latch
library cache
messages
object queue header operation
row cache objects
shared pool
redo writing
MQL Tracking Latch
Change Notification Hash table latch
library cache lock
virtual circuit queues
enqueue hash chains
ges resource hash list
cache buffers chains
KCL gc element parent latch
undo global data
parallel query alloc buffer
27 rows selected.
查看V$system_event中latch free等待事件的wait time:
SQL> select event,time_waited_micro from v$system_event where event='latch free';
EVENT TIME_WAITED_MICRO
---------------------------------------------------------------- -----------------
latch free 107431
再查看v$latch视图中没有在v$event_name中定义的所有latch等待时间:
SQL> select sum(wait_time) from v$latch where name not in (select substr(name,8) from v$event_name where name like 'latch:%');
SUM(WAIT_TIME)
--------------
107431
二者正好相等,可以推断,oracle并没有把所有种类的latch都进行细化,而只是把一些可能是常见的latch(27个)进行细化,剩余的其它latch的等待仍然归于'latch free'这个等待事件中。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10972173/viewspace-591829/ ,如需转载,请注明出处,否则将追究法律责任。