TABLE的High WaterMark(即高水位線)辨別table segment中已用空間和未用空間的邊界,具體來講,HWM以上的block的狀态是:unformattedand have never been used; HWM以下的block的狀态是:Allocated, but currentlyunformatted and unused、 Formatted and contain data、Formatted and empty because the data was deleted。當HWM以下的block都無空閑空間可以使用時,Oracle會推進HWM來申請配置設定新的block到segment裡面,而HW enqueue鎖被用來管理推進HWM配置設定新空間時的串行操作。
?EVENT="44951 TRACE NAME CONTEXT FOREVER, LEVEL < 1 -1024 >"
為防止多個程序同時修改HWM而提供的鎖稱為HW鎖(官方文檔解釋:Space management operations on a specific segment)。想要移動HWM的程序必須獲得HW鎖。HW鎖争用大部分是因為大量執行insert所引發的,偶爾也會因大量執行update在復原段中發生HW鎖争用現象。若是update,表中段的擴充的大小雖然不多,但在建立復原資料的過程中,需要復原段的急速擴張。HW鎖争用是在段的急速空間擴張時普遍出現的等待現象,有時也會引發嚴重的性能下降。
ASSM high-HWM extensions(擴張) are not done over extent boundaries(邊界) IIRC, thus with small extents you'd have lots of extensions to do, each requiring HW-enqueue get.ASSM relieves(解除,降低) HW-enqueue contention by increasing HHWM in large sizes (depending on extent and current segment size),so less HW operations have to be done.
The LHWM extensions can be done without having HW-enqueue as they involve(包含) only changing few records in a BMB block (我估計應該是位圖塊,不确定)and the BMB is pinned(釘住) for that exclusively anyway. The actual batch formatting(批量格式化) of datablocks is done while having FB enqueue, allowing finer(出色的) granularity(粒度) of locking block ranges in case of multiple parallel inserts.
相關讨論:http://www.itpub.net/thread-1242093-1-1.html
如何找到'事件:enq: HW - contention'對應的熱點segment
HW enqueue
The HW enqueue is used to serialize the allocation of space beyond the high water mark of a segment.
V$SESSION_WAIT.P2/V$LOCK.ID1is the tablespace number.
V$SESSION_WAIT.P3/V$LOCK.ID2is the relative dba of segment header of the object for which space is being allocated.
If this is a point of contention for an object, then manual allocation of extents solves the problem.
SQL> select p1, p2, p3 from v$session_wait where event = 'enq: HW - contention';
半小時的采樣時間,DB Time 215mins,其中等待時間“enq: HW - contention”占據近36%,為TOP 10 events中最主要的非空閑等待事件。
等待事件“enq: HW - contention”的解釋:
The HW enqueue is used to manage the allocation of space beyond the high water mark of a segment. The high water mark of a segment is the boundary between used and unused space in that segment. If contention is occurring for "enq: HW - contention" it is possible that automatic extension is occuring to allow the extra data to be stored since the High Water Mark has been reached. Frequent allocation of extents,reclaiming chunks,and sometimes poor I/O performance may be causing contention for the LOB segments high water mark.
The HW enqueue is used to serialize the allocation of space beyond the high water mark of a segment. If lots of data is being added to an object concurrently, then multiple processes may be trying to allocate space above the high water mark at the same time, leading to contention.