US contention: Lock held to perform. DDL on the undo segment
http://tech.sina.com.cn/s/2009-09-23/09561077577.shtml
看到一篇fuyuncat写的关于US-contention的troubleshooting 案例,以前从没有接触过类似的enqueue,仔细阅读几遍并记下笔记;然后又多搜了几篇类似的案例,以备后用。

该案例大致总结
"Active Sessions Waiting: Other" 统计了RAC中除了IO和Idle waits之外的所有wait事件
AWR中top 5占了两席
DFS lock handle—会话等待获取一个全局锁句柄,全局锁由DLM(分布式锁管理器)管理和分配的,这一等待事件说明全局锁句柄资源不够用,决定参数_lm_locks,9i后默认为12000;说明大量事务获取锁,但没有commit/rollback;
enq: US – contention 说明事务在队列中等待UNDO segment,通常由于UNDO空间不足导致
首先查找这两个等待事件的wait对象
Select * from Dba_objects in( select current_obj#,count(*) from dba_hist_active_sess_history where event=’DFS lock handle’ and snap_id between *** and ***)
发现两个等待事件的对象基本相同
Undo资源不足,可能是undo_retention时间过长且设置为guarantee,select retention,tablespace_name from dba_tablespaces where tablespace_name like ‘UNDO%’查看发现没有设置guarantee
接着查看哪些事务消耗了UNDO,但是只有一个transaction;
那就查看UNDO的实际使用情况 select * from dba_segments where segment_type like ‘%UNDO%’ 结果显示一个回滚段_SYSSMU69$占了将近20g,查看该回滚段的extents的状态
Select status, count(*) from dba_undo_extents where segment_name ='_SYSSMU69$' group by status; 全部为active,则说明有事务正在使用所有的扩展段,但又找不到这样的事务,原因是一个使用该回滚段的事务被异常终止了,先是通过kill session杀死,但是仍会回滚还未提交的事务,于是直接在OS删除

由于该回滚段状态仍未online,且所有extents都是active,所以无法drop或shrink,解决方案:
1、 重启实例,重置回滚段;
2、 新增一个undo表空间,使其他事务正常运行;杀掉由于等待而彻底hung的会话,恢复正常

总结:作者在AWR top 5 events里发现两个等待事件,然后判断US contention为元凶,先检查undo_retention/guarantee的参数设置,接下来查看UNDO表空间的使用状况,dba_segments里发现一个非常大的undo segment,进而查找dba_undo_extents以确认其extents的状态,最后联系开发人员找到原因;

另外一个案例 来源http://www.itpub.net/redirect.php?tid=1269096&goto=lastpost

RAC出现大量的row cache lock + us contention
前者是由于一个sequence设置为nocache,修改后变好;后一个猜测undo出问题,直接查active+unexpired的总和,接近undo表空间的大小,临时增大undo表空间并kill掉消耗量最大的impdp进程

第三个案例来自eagle fan http://www.dbafan.com/blog/?p=170
10203版本
AUM管理方式是系统不忙的时候offline一些undo segment,不够用时再online;而当系统特别繁忙时online或者resize或出现问题--10511事件解决;
但此刻并不繁忙
作者留意到v$undostat中的unxpblkreucnt: Number of unexpired undo blocks reused by transactions
该列值不为0,一般只有当undo不够存放undo_retention时间段内的数据时,才会发生unexpired undo extents stealing;
但是目前不是高峰期,作者留意到v$undostat中的tuned_undoretention字段,10.2之后,oracle默认采用自动调整undo retention,会根据undo大小以及系统繁忙程度字段调整undo_retention参数;
出问题前一天数据库重启过,因为起来很空闲,所以tuned_undoretention很大,undo被撑满,虽然该字段值一直在降,但还是没有赶上系统warm up的速度,导致数据库出现问题;
通过设置_undo_autotune为disable,不再自动更新。
总结:出现US contention,并且是在系统不繁忙的时候,作者留意到v$undostat中的unxpblkreucnt参数,由此推断出该enqueue是由于oracle 10.2以后的新特性引起的,通过设置隐含参数屏蔽此特性来最终解决

How to correct performance issues with enq: US - contention related to undo segments [ID 1332738.1]

Purpose

Assist in correcting performance issues related to "enq: US Contention" on undo segments.

You have many offline undo segments and the workload starts to online many undo segments over a short period of time. This can lead to high 'latch: row cache objects' contention may be seen on dc_rollback_segments together with high 'enq: US - contention' waits when using system managed undo with an auto tuned undo retention period.

Sessions attempting to online undo segments should show ktusmous_online_undoseg() in their call stack.

Another aspect of the problem can be due to long running queries which can raise tuned_undoretention to very high values and exhausts the undo tablespace resulting in ORA-1628.

A real world case:
A query is being executed and some rows are fetched from the cursor and then the user stops working on that query (e.g. does not press the "next" button on the application screen) and works on something else (e.g. in a different window). After some time the user continues working on the query ... auto-tune starts tracking the query from this point and the maxquerylen is quite large now, hence also the tuned_undoretention (that depends directly on the maxquerylen).

NOTE: The Seibel application can allow for this problem to happen.

Last Review Date

June 24, 2011

Instructions for the Reader

A Troubleshooting Guide is provided to assist in debugging a specific issue. When possible, diagnostic tools are included in the document to assist in troubleshooting.

Troubleshooting Details

The wait event "enq: US Contention" is associated with contention on the latch in the row cache (dc_rollback_seg). Enqueue US - Contention can become a bottle-neck for performance if workload dictates that a lot of offlined undo segments must be onlined over a short period of time. The latch on the row cache can be unable to keep up with the workload.

This can happen for a number of reasons and some scenarios are legitimate workload demands.

Solution:

Ensure that peaks in onlined undo segments do not happen (see workaround #2). That is not always feasible.

Workarounds:

1. Bounce the instance.

2. Setting _rollback_segment_count to a high number to keep undo segments online.

alter system set "_rollback_segment_count"=;

3. Set _undo_autotune to false

alter system set "_undo_autotune" = false;

NOTE: Simply using _smu_debug_mode=33554432 may not be enough to stop the problem, but valid fix for bug 5387030.

4. A fix to bug 7291739 is to set a new hidden parameter, _highthreshold_undoretention to set a high threshold for undo retention completely distinct from maxquerylen.

alter system set "_highthreshold_undoretention"=;

If problems persist, please file a Service Request with Oracle Support.

@ Diagnosis
@
@ Should the workarounds and/or configuration changes not help to alleviate the problems,
@ development would need the following diagnostics data:
@
@ a. Provide alert.log which shows the last instance startup parameters through the time of the
@ latest isssues.
@
@ b. AWR and/or ASH report of 30 or 60 minutes interval.
@
@ b. Following query output:
@
@ alter session set nls_date_format='mm/dd/yy hh24:mi:ss';
@ select begin_time, MAXQUERYID, MAXQUERYLEN from v$undostat;
@
@ c. While the error is ongoing:
@
@ On single instance:
@
@ sqlplus / as sysdba
@ oradebug setmypid
@ oradebug unlimit
@ oradebug hanganalyze 3
@ oradebug dump systemstate 266
@
@ wait for 5 seconds
@
@ oradebug dump systemstate 266
@
@ wait for 2 minutes
@
@ sqlplus / as sysdba
@ oradebug setmypid
@ oradebug unlimit
@ oradebug hanganalyze 3
@ oradebug dump systemstate 266
@
@ wait for 5 seconds
@
@ oradebug dump systemstate 266
@
@ On RAC get tracing on all nodes
@
@ sqlplus / as sysdba
@ oradebug setmypid
@ oradebug unlimit
@ oradebug -g all hanganalyze 3
@ oradebug -g all dump systemstate 266
@
@ wait for 5 seconds
@
@ oradebug -g all dump systemstate 266
@
@ wait for 2 minutes
@
@ sqlplus / as sysdba
@ oradebug setmypid
@ oradebug unlimit
@ oradebug -g all hanganalyze 3
@ oradebug -g all dump systemstate 266
@
@ wait for 5 seconds
@
@ oradebug -g all dump systemstate 266

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26736162/viewspace-2124740/,如需转载,请注明出处,否则将追究法律责任。

关于enq: US – contention相关推荐

  1. oracle中ci是什么意思,enq: CI - contention(附AWR)

    enq: CI - contention是个什么玩意? 一个库CI LOCK严重(ID1=1,ID2=5) 查了下,都是下面的语句引起的(字段太多了没设long了): SID SQL_ID       ...

  2. [20161208]等待事件enq: HW - contention

    [20161208]等待事件enq HW - contention.txt --别人的系统遭遇enq: HW - contention,自己诊断遇到一点点小误区,实际上我看看我原来的帖子就知道问题在那 ...

  3. 一次不常见的等待事件:RECO进程enq: DR - contention

    某用户反映数据库中有一个账号的费用结算有问题,排查数据库状态,发现有一个不常见的等待事件,PROGRAM:oracle@db01 (RECO),EVENT:enq: DR - contention(阻 ...

  4. 【MW】Drop Materialized View Hangs with 'Enq: JI - Contention'

    适用的数据库版本[Release 10.2 to 11.2] 事件:当运行DROP MATERIALIZED VIEW 时 会话hang住. 用下面命令生成跟踪文件(通过任意会话): 点击(此处)折叠 ...

  5. 【等待事件】序列等待事件总结(enq: SQ - contention、row cache lock、DFS lock handle和enq: SV - contention)...

    [等待事件]序列等待事件总结(enq: SQ - contention.row cache lock.DFS lock handle和enq: SV - contention) [等待事件]序列等待事 ...

  6. 事务上的等待事件 —— enq: TM - contention

    执行DML期间,为防止对与DML相关的对象进行修改,执行DML的进程必须对该表获得TM锁.若在获得TM锁的过程中发生争用,则等待enq: HW - contention 事件. SQL> sel ...

  7. enq: HW - contention

    1.今天发生一起enq: HW - contention引起的性能问题,记录一下: 2.查看enq: HW - contention有关的信息 select SAMPLE_TIME,MACHINE,S ...

  8. enq: PS - contention

    测试环境中发现一个进程长时间占用12.7%cpu Name              PID    CPU%  PgSp Owner oracle       557222     12.7   78 ...

  9. Oracle enq: TX contention 和 enq: TM contention 等待事件说明

    和Oracle性能优化密切相关的一些知识参考如下Blog: Oracle 常见的33个等待事件 http://blog.csdn.net/tianlesoftware/archive/2010/08/ ...

最新文章

  1. openssl生成rsa密钥对和密钥格式转换
  2. mysql 代码执行时间_mysql 显示SQL语句执行时间的代码
  3. [图解]小白都能看懂的FASTER R-CNN – 原理和实现细节
  4. WEB服务器技术名词
  5. 服务器上批量替换html内的字符,如何批量替换字符串中的某个特定字符?
  6. 为什么选用自增量作为主键索引
  7. [转载]在vim中针对c++自动补全
  8. php文件锁不起作用,php文件锁产生的问题和解决方案(一个真实案例)
  9. ★一张图弄明白从零维到十维
  10. 项目需求讨论--可能是用InputFilter来做的最好的金额限制
  11. Android腾讯云直播开发,笔记:腾讯云直播SDK测试demo
  12. Sql Server2014数据库安装教程
  13. 今年阿里巴巴重要开源项目全在这里
  14. python dataframe 增加一行
  15. [CF1528F]AmShZ Farm
  16. css实现两个div填满一行
  17. 反病毒垃圾邮件,U-Mail邮件系统从容应对
  18. numpy简单实现梯度投影法
  19. 生活妙招:疏通蹲便器和地漏中的头发堵塞
  20. Python爬虫,爬取51job上有关大数据的招聘信息

热门文章

  1. Boss掉落物品问题
  2. 荣耀30 pro鸿蒙系统,爆料:荣耀 30 Pro已开始测试华为鸿蒙系统
  3. 软件登录软件 DIY
  4. 联想拯救者Y7000重装win10系统卡在logo界面
  5. opencv手势识别(3_SVM算法识别)
  6. Newtonsoft.Json.JsonSerializationException
  7. 卡通风珍惜粮食人人有责节约粮食文明就餐从我做起通用PPT模板
  8. 【01Studio MaixPy AI K210】1.LED
  9. 行动诠释价值,城联优品韩董事长出席广东英德抗洪捐赠公益活动会
  10. 33岁跳槽无路,走投无路之际受贵人指点,成功上岸阿里(Java岗)