产生原因

官方定义:

This wait happens when a session wants to access a database block in the buffer cache but it cannot as the buffer is "busy". The two main cases where this can occur are:

Another session is reading the block into the buffer

Another session holds the buffer in an incompatible mode to our request

模拟等待

创建测试表并插入数据:

SQL> create table tb1 (id int ,name varchar2(10));

Table created.

SQL> insert into tb1 values (1,'scott');

1 row created.

SQL> insert into tb1 values (2,'tom');

1 row created.

SQL> commit;

Commit complete.

复制代码

会话1修改数据:

SQL> select userenv('sid') from dual;

USERENV('SID')

--------------

1

SQL> begin

for i in 1..100000 loop

update tb1 set name='rose' where id=2;

commit;

end loop;

end;

/

复制代码

会话2修改数据:

SQL> select userenv('sid') from dual;

USERENV('SID')

--------------

27

SQL> begin

for i in 1..100000 loop

update tb1 set name='john' where id=1;

commit;

end loop;

end;

/

复制代码

在会话3查看等待情况:

--定位到造成等待的SQL

SQL> SELECT g.inst_id,g.sid,g.serial#,g.event,g.username,g.sql_hash_value,s.sql_fulltext

FROM gv$session g,v$sql s

WHERE g.sql_hash_value = s.hash_value and username='HR' and event='buffer busy waits';

INST_ID SID SERIAL# EVENT USERNAME SQL_HASH_VALUE SQL_FULLTEXT

---------- ---------- ---------- ------------------------------ ---------- -------------- --------------------------------------------------

1 1 7 buffer busy waits HR 401484711 UPDATE TB1 SET NAME='rose' WHERE ID=2

1 27 49 buffer busy waits HR 2040921087 UPDATE TB1 SET NAME='john' WHERE ID=1

--定位到热点快

SQL> select event,sid,p1,p2,p3 from v$session_wait_history where event='buffer busy waits'

EVENT SID P1 P2 P3

-------------------- ---------- ---------- ---------- ----------

buffer busy waits 1 4 5471 1

buffer busy waits 1 4 5471 1

buffer busy waits 1 4 5471 1

buffer busy waits 1 4 5471 1

buffer busy waits 1 4 5471 1

buffer busy waits 27 4 5471 1

buffer busy waits 27 4 5471 1

buffer busy waits 27 4 5471 1

buffer busy waits 27 4 5471 1

buffer busy waits 27 4 5471 1

10 rows selected.

--P1=file#

--P2=block#

--定位到块所属的段

SQL> SELECT OWNER, SEGMENT_NAME, SEGMENT_TYPE, TABLESPACE_NAME, A.PARTITION_NAME FROM DBA_EXTENTS A WHERE FILE_ID = 4 AND 5471 BETWEEN BLOCK_ID AND BLOCK_ID + BLOCKS - 1;

OWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME PARTITION_NAME

---------- -------------------- ------------------ ------------------------------ ------------------------------

HR TB1 TABLE USERS

复制代码

解决方法

As buffer busy waits are due to contention for particular blocks then you cannot take any action until you know which blocks are being competed for and why. Eliminating the cause of the contention is the best option. Note that "buffer busy waits" for data blocks are often due to several processes repeatedly reading the same blocks (eg: if lots of people scan the same index) - the first session processes the blocks that are in the buffer cache quickly but then a block has to be read from disk - the other sessions (scanning the same index) quickly 'catch up' and want the block which is currently being read from disk - they wait for the buffer as someone is already reading the block in.

The following hints may be useful for particular types of contention - these are things that MAY reduce contention for particular situations:

Block TypePossible Actionsdata blocksEliminate HOT blocks from the application. Check for repeatedly scanned / unselective indexes. Change PCTFREE and/or PCTUSED. Check for 'right- hand-indexes' (indexes that get inserted into at the same point by many processes). Increase INITRANS. Reduce the number of rows per block.

segment headerIncrease of number of FREELISTs. Use FREELIST GROUPs (even in single instance this can make a difference).

freelist blocksAdd more FREELISTS. In case of Parallel Server make sure that each instance has its own FREELIST GROUP(s).

undo headerAdd more rollback segments.

参考: WAITEVENT: "buffer busy waits" Reference Note (Doc ID 34405.1)

欢迎关注我的公众号,一起学习。

前台等待事件 oracle,Oracle等待事件之buffer busy waits相关推荐

  1. Oracle等待事件(三)—— buffer busy waits 常见原因及对应解决方法

    也先看看buffer busy waits在官方文档中的描述 This wait indicates that there are some buffers in the buffer cache t ...

  2. 等待事件buffer busy waits

    转载自:http://blog.csdn.net/cymm_liu/article/details/7968537 非空闲等待之:buffer busy waits buffer busy wait ...

  3. buffer busy waits等待事件的原因:hot block [转]

    http://blog.chinaunix.net/u/24260/showart_456274.html ********************************************** ...

  4. buffer busy waits等待事件案例-vage

    讨厌香草冰激凌的汽车与Buffer busy wiats的故事 记得好几年前看到过一个故事,通用公司曾收到一客户的邮件,邮件中客户描述了一个非常奇怪的问题.他们家有晚饭后去吃冰激凌的习惯,如果他们买的 ...

  5. oracle等待事件4——buffer busy wait 特别介绍

    以下内容太整理自网络,完全处于学习目的,如有侵权请及时联系我,我会立即删除. 非空闲等待之:buffer busy waits 事件参数说明: 事件号 事件名 参数一 参数二 参数三 145 buff ...

  6. oracle+buffer+busy+wait,Oracle数据库buffer busy wait等待事件 (2)

    --查找等待块类型 SELECT 'segment Header' CLASS, a.Segment_Type, a.Segment_Name, a.Partition_Name FROM Dba_S ...

  7. oracle数据库等待事件

    查看等待事件 select inst_id,event,count(*) from gv$session where wait_class <> 'Idle' group by inst_ ...

  8. oracle缓冲等待块,CSS_Oracle数据库buffer busy wait等待事件, 当会话意图访问缓冲存储 - phpStudy...

    Oracle数据库buffer busy wait等待事件 当会话意图访问缓冲存储器中的数据块,而该数据块正在被其它会话使用时产生buffer busy waits事件.其它会话可能正在从数据文件向缓 ...

  9. RAC性能分析 - gc buffer busy acquire 等待事件

    概述 --------------------- gc buffer busy是RAC数据库中常见的等待事件,11g开始gc buffer  busy分为gc buffer busy acquire和 ...

最新文章

  1. 网页制作插入新的元素,并且为插入的元素添加事件
  2. 这是一个不完整的详细Java多线程,但对于初学者足够了,相信我,你会爱上她的
  3. How can I exclude directories from grep -R?
  4. java中精确地小数_在Java等于方法中进行精确比较
  5. 微型计算机硬盘为什么要分区,为什么懂电脑的人,都说硬盘不需要分区?看完你就知道了...
  6. JDK源码解析之java.util.AbstractCollection
  7. TensorFlow官方教程翻译:导入数据
  8. eclipse不能添加tomcat7的问题
  9. shell中可能经常能看到:/dev/null 21
  10. 合肥信息技术职业学院计算机模拟考试准考证,【通知】全国计算机等级考试模拟测试通知...
  11. java 日期calendar_Java中用Calendar类计算周和周的起始日期(转)
  12. 每日一题/011/线性代数/高等代数/两个上三角矩阵的乘积还是上三角矩阵
  13. python中文文本分类
  14. 中国手机用户换机越来越慢
  15. 计算机桌面为什么没有语言栏了,电脑语言栏不见了怎么调出来_电脑语言栏没有了怎么恢复...
  16. 转:英语 表示字母、数字的复数
  17. 维度数据建模的概念和术语
  18. 计算机配置高低怎么看,怎么看电脑配置高低
  19. Flask asyncio 异步处理请求
  20. 软件测试自学摄影审美,【摄影讲评】摄影常用的5种透视 第1234讲?

热门文章

  1. springboot判断有没有库_Springboot 使用JPA @Query 注解 查询语句条件 有可能为空,Oracle数据库...
  2. treeset java_Java TreeSet add()方法与示例
  3. avr计数_使用8位LCD创建计数器| AVR
  4. 操作系统 非连续分配_操作系统中的连续和非连续内存分配
  5. 收银系统 mysql数据库_某大型超市收银系统数据库成功恢复
  6. oracle11优点,争先体味Oracle 11g的新特点
  7. 一个事物两个方面的对比举例_顶管施工也有讲究,两个方面一个个来
  8. HashMap 为什么在链表长度为 8 的时候转红黑树,为啥不能是 9 是 10?
  9. C# Winform 窗体美化(九、嵌入窗体)
  10. Windows MinGW cmake 安装编译Opencv 3.4.3 C++开发环境