开发者社区> lfreeali> 正文
阿里云
为了无法计算的价值
打开APP
阿里云APP内打开

[20140311]等待事件enq HW - contention

简介: [20140311]等待事件enq HW - contention.txt 生产系统业务高峰时出现enq: HW - contention,一般这个主要是插入记录非常密集的情况下出现,自己对系统分析看看主要是那些对象 引起的问题。
+关注继续查看

[20140311]等待事件enq HW - contention.txt

生产系统业务高峰时出现enq: HW - contention,一般这个主要是插入记录非常密集的情况下出现,自己对系统分析看看主要是那些对象
引起的问题。

SQL> @ver

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi


SELECT event,
         sql_id,
         TO_CHAR (sample_time, 'hh24') hours,
         COUNT (*)
    FROM DBA_HIST_ACTIVE_SESS_HISTORY
   WHERE event LIKE 'enq: HW - contention'
GROUP BY event, sql_id, TO_CHAR (sample_time, 'hh24')
ORDER BY COUNT (*) DESC;


EVENT                 SQL_ID        HO     COUNT(*)
--------------------- ------------- -- ------------
enq: HW - contention  dhs7skn7kdxdr 11           53
enq: HW - contention  dhs7skn7kdxdr 10           39
enq: HW - contention  dhs7skn7kdxdr 16           23
enq: HW - contention  dhs7skn7kdxdr 17           23
enq: HW - contention  dhs7skn7kdxdr 09           12
enq: HW - contention  66mu5zrxm7u61 11            3
enq: HW - contention  dhs7skn7kdxdr 15            3
enq: HW - contention  dhs7skn7kdxdr 12            3
enq: HW - contention  66mu5zrxm7u61 16            2
enq: HW - contention  dhs7skn7kdxdr 08            2
enq: HW - contention  66mu5zrxm7u61 15            1
enq: HW - contention  66mu5zrxm7u61 09            1
enq: HW - contention  66mu5zrxm7u61 08            1

13 rows selected.

--很明显主要出现在10,11,16,17点的业务高峰,sql_id='dhs7skn7kdxdr'.
--但是奇怪我查询相关视图v$sql,dba_hist_sql*都没有查询到对应的sql语句。
SQL> select * from v$sql where sql_id in ('dhs7skn7kdxdr','66mu5zrxm7u61');
no rows selected

SQL> select * from v$event_name where name='enq: HW - contention';
      EVENT#     EVENT_ID NAME                 PARAMETER1           PARAMETER2           PARAMETER3           WAIT_CLASS_ID  WAIT_CLASS# WAIT_CLASS
------------ ------------ -------------------- -------------------- -------------------- -------------------- ------------- ------------ --------------------
         180   1645217925 enq: HW - contention name|mode            table space #        block                   3290255840            2 Configuration

SELECT event, sql_id, sample_time, p2, p3 FROM DBA_HIST_ACTIVE_SESS_HISTORY
WHERE event LIKE 'enq: HW - contention' AND sql_id = 'dhs7skn7kdxdr'  AND ROWNUM

EVENT                 SQL_ID        SAMPLE_TIME                          P2           P3
--------------------- ------------- -------------------------- ------------ ------------
enq: HW - contention  dhs7skn7kdxdr 04-MAR-14 11.51.44.145 AM             6     25176955

--看了一些文档才知道参数3是指块地址RBA而非块。

select dbms_utility.data_block_address_file(&1) rfile#, dbms_utility.data_block_address_block(&&1) block# from dual;

      RFILE#       BLOCK#
------------ ------------
           6        11131

SQL> select segment_name,file_id,block_id from dba_extents where file_id = 6  and 11131 between block_id and block_id + blocks - 1;
SEGMENT_NAME                    FILE_ID     BLOCK_ID
-------------------------- ------------ ------------
SYS_LOB0000059813C00002$$             6        11129

SQL> select segment_name,header_file,header_block from dba_segments where segment_name='SYS_LOB0000059813C00002$$';
SEGMENT_NAME                HEADER_FILE HEADER_BLOCK
-------------------------- ------------ ------------
SYS_LOB0000059813C00002$$             6        11131

--很明显是lob段的段头在增加分配空间时存在争用。

--换一个思路查询,V$open_cursor视图看看。
SQL> select distinct sql_id,sql_text from V$OPEN_CURSOR where  sql_id in ('dhs7skn7kdxdr','66mu5zrxm7u61');
SQL_ID        SQL_TEXT
------------- ------------------------------------------------------------
66mu5zrxm7u61 table_e_a_e981_5_0_0
dhs7skn7kdxdr table_e_a_e9a5_2_0_0

SQL> select count(*),KGLNAOBJ,kglobt03 from x$kglcursor where kglobt03 in ('dhs7skn7kdxdr','66mu5zrxm7u61') group by
KGLNAOBJ,kglobt03;
    COUNT(*) KGLNAOBJ                                 KGLOBT03
------------ ---------------------------------------- -------------
           5 table_e_a_e981_5_0_0                     66mu5zrxm7u61
           5 table_e_a_e9a5_2_0_0                     dhs7skn7kdxdr


-- 确实是lob类型的数据。而且在业务高峰插入密集。

SYS@test> @16to10 e981
16 to 10 DEC
------------
       59777

SYS@test> @16to10 e9a5
16 to 10 DEC
------------
       59813


--使用select * from dba_objects where object_id in (59777,59813);可以确定是那个表。table_e_a_e981_5_0_0 ,5表示字段的顺序。
--仅仅分析其中一个看看。

SELECT * FROM dba_lobs WHERE (OWNER, TABLE_NAME) IN (SELECT owner, object_name FROM dba_objects WHERE object_id = 59813);

SQL> SELECT SEGMENT_NAME,INDEX_NAME FROM dba_lobs WHERE (OWNER, TABLE_NAME) IN (SELECT owner, object_name FROM
dba_objects WHERE object_id = 59813);

SEGMENT_NAME                   INDEX_NAME
------------------------------ ------------------------------
SYS_LOB0000059813C00002$$      SYS_IL0000059813C00002$$

--64k=>1M->8M->64M.

--解决方法也许只能预先给这个段分配好空间,其他好像也没有什么好方法。

alter table .

google 找到如下连接:
http://dbasolved.com/2014/03/05/combat-with-an-enqueue-wait-event-enq-hwcontention/
http://www.oracledatabase12g.com/archives/%E5%88%A9%E7%94%A844951-event%E8%A7%A3%E5%86%B3lob-space-enq-hw-contention%E7%AD%89%E5%BE%85%E4%BA%89%E7%94%A8.html

Opening the SR has lead me to dig a bit and do some research on extent allocation and LOBs while waiting on Oracle's
answer. Prior to Oracle Database 11g (11.2.0.1), there is a known bug (6376915). This bug is related to high watermark
enqueue contention for ASSM LOB segments (Note ID: 6376915.8). This bug was actually fixed in release 11.2.0.1 but it
needs to be "turned on" in later releases. To turn the fix for this bug on in 11.2.0.2+, an event needs to be set in the
spfile.

SQL> ALTER SYSTEM SET EVENT="44951 TRACE NAME CONTEXT FOREVER, LEVEL " scope=spfile;

By setting this event between 1 and 1024 will identify the number of chunks to be cleaned up each time a reclamation
operation is performed. In turn this reduces the number of requests against the high watermark enqueue.

Once the event has been set in the spfile, the database instance needs to be rebooted to make the change effective.

阅读(2461) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
【故障处理】队列等待之enq IV - contention案例
【故障处理】队列等待之enq IV -  contention案例 1.1  BLOG文档结构图   1.2  前言部分 1.
1435 0
关于enq: US – contention
  US contention: Lock held to perform. DDL on the undo segmenthttp://tech.sina.com.cn/s/2009-09-23/09561077577.shtml看到一篇fuyuncat写的关于US-contention的troubleshooting 案例,以前从没有接触过类似的enqueue,仔细阅读几遍并记下笔记;然后又多搜了几篇类似的案例,以备后用。
3059 0
【故障解决】enq: PS - contention
【故障解决】enq: PS - contention 一.1  BLOG文档结构图       一.2  前言部分   一.
1434 0
enq: CF - contention 等待事件
背景说明:用户反馈数据库运行很慢,但是等查看的时候又恢复了正常,果断的查看了过去一段时间的AWR报告; AWR报告信息如下:   从db time/Elapsed显示数据库的压力并不是很大。
1162 0
ORACLE等待事件:enq: TX - row lock contention
enq: TX - row lock contention等待事件,这个是数据库里面一个比较常见的等待事件。enq是enqueue的缩写,它是一种保护共享资源的锁定机制,一个排队机制,先进先出(FIFO)。
1326 0
+关注
lfreeali
熟悉oracle数据库性能优化,rman备份,数据库恢复技术.
2121
文章
0
问答
文章排行榜
最热
最新
相关电子书
更多
低代码开发师(初级)实战教程
立即下载
阿里巴巴DevOps 最佳实践手册
立即下载
冬季实战营第三期:MySQL数据库进阶实战
立即下载