select event,p1,p2,p3 from v$session  where event like 'enq%';

EVENT P1 P2 P3
1 enq: HW - contention 1213661190 6 48639810
2 enq: HW - contention 1213661190 6 48639810



通过P3进行DBMS_UTILITY转换可以获知发生争用的文件和block
SQL> select DBMS_UTILITY.DATA_BLOCK_ADDRESS_FILE(48639810) FILE#,
DBMS_UTILITY.DATA_BLOCK_ADDRESS_BLOCK(48639810) BLOCK#
from dual;

FILE# BLOCK#
1 11 2502466


select owner, segment_type, segment_name
from dba_extents
where file_id = 11
and 2502466 between block_id and block_id + blocks - 1;


OWNER SEGMENT_TYPE SEGMENT_NAME
1 TLCB TABLE WEBSERVICE_MSG


原因:表空间满了,数据库忙于分配空间。

SQL> select parameter1,parameter2,parameter3 from v$event_name where name='enq: HW - contention';

PARAMETER1 PARAMETER2 PARAMETER3
---------------------------------------------------------------- ---------------------------------------------------------------- ----------------------------------------------------------------
name|mode table space # block


SELECT event,
p1,
p2,
p3,
Count(1)
FROM dba_hist_active_sess_history
WHERE event_id = 1645217925
GROUP BY event,
p1,
p2,
p3;

EVENT P1 P2 P3 COUNT(1)
--------------------- -------------------- ---------- ---------- --------
enq: HW - contention 1213661190 14 58720522 22681


我们得到信息从 dba_hist_active_sess_history,这个视图包含了最近系统活动的在内存里的信息。

下一步是用 dbms_utility包来确定当前文件号和块号

SELECT
dbms_utility.Data_block_address_file(58720522) FILE#,
dbms_utility.Data_block_address_block(58720522) BLOCK#
FROM dual;

FILE# BLOCK#
---------- ----------
14 266


Now we can use this information to get which segment it belongs too.

SELECT owner,
segment_type,
segment_name
FROM dba_extents
WHERE file_id = 14
AND 266 BETWEEN block_id AND block_id + blocks - 1;

OWNER SEGMENT_TYPE SEGMENT_NAME
------------- ----------------- -------------------------------------
XXXX LOBSEGMENT SYS_LOB0000014653C00008$$