什么是buffer busy wait?

        A session that reads or modifies a buffer in the SGA must first acquire the cache buffers chains latch and traverse the buffer chain until it finds the necessary buffer header. Then it must acquire a buffer lock or a pin on the buffer header in shared or exclusive mode, depending on the operation it intends to perform. Once the buffer header is pinned, the session releases the cache buffers chains latch and performs the intended operation on the buffer itself. If a pin cannot be obtained, the session waits on the buffer busy wait event. This wait event does not apply to read or write operations that are performed in sessions’ private PGAs.

一个会话读或者修改一个SGA中的buffer,首先必须获得cache buffers chains latch和遍历缓冲区链表,直到找到所需的缓冲区头。

会话必须获得一个buffer lock或者pin在 shared or exclusive 模式下,这取决于它打算执行的操作。一旦缓冲区头被pin住,会话释放的超高速缓冲存储器锁存器链,并且执行在缓冲本身预定的操作。如果不能获得pin后,会话的缓冲区忙等待事件等待。这个等待事件不适用于读取或写入都在会话的私有PGA的执行的操作。

读写时兼容的,写写是不兼容的:

此实验是不断的去更新同一个块中的不同记录,通过这种方式可以造成buffer busy wait等待.

--创建测试表

create table test_db
(
ID NUMBER,
NICK VARCHAR2(30)
); SQL> insert into test_db values(1,'zhaolin'); 1 row created. SQL> commit; Commit complete. SQL> insert into test_db values(2,'nature'); 1 row created. SQL> commit; Commit complete. SQL> select rowid,t.* from test_db t; ROWID ID NICK
------------------ ---------- ------------------------------
AAATKfAAEAAAtZHAAA 1 zhaolin
AAATKfAAEAAAtZHAAB 2 nature --检查这两条记录是否在同一个块上 SQL> select dbms_rowid.ROWID_RELATIVE_FNO(rowid) file#,dbms_rowid.ROWID_BLOCK_NUMBER(rowid) block# from test_db; FILE# BLOCK#
---------- ----------
4 185927
4 185927 --session 1 SQL> select sid from v$mystat where rownum<2; SID
----------
33 declare
i number:=0;
begin
loop
update test_db set nick='session1' where id=1;
i:=i+1;
if mod(i,100)=0 then
commit;
end if;
end loop;
end; --session 2 SQL> select sid from v$mystat where rownum<2; SID
----------
1 declare
i number:=0;
begin
loop
update test_db set nick='session2' where id=2;
i:=i+1;
if mod(i,100)=0 then
commit;
end if;
end loop;
end; --我们再启动会话session3 SQL> col name format a30
SQL> select SESSION_ID,NAME,P1,P2,P3,WAIT_TIME,CURRENT_OBJ#,CURRENT_FILE#,CURRENT_BLOCK#
from v$active_session_history ash, v$event_name enm
where ash.event#=enm.event#
and ash.session_id in (1,33) 2 3 4
5 ; SESSION_ID NAME P1 P2 P3 WAIT_TIME CURRENT_OBJ# CURRENT_FILE# CURRENT_BLOCK#
---------- ------------------------------ ---------- ---------- ---------- ---------- ------------ ------------- --------------
33 latch: In memory undo latch 836651180 243 0 0 78495 4 185927
33 buffer busy waits 4 185927 1 0 78495 4 185927
1 latch: cache buffers chains 884779988 150 0 0 -1 0 0
1 buffer busy waits 4 185927 1 0 78495 4 185927
33 latch: cache buffers chains 884779988 150 0 0 -1 0 0
1 buffer busy waits 4 185927 1 0 78495 4 185927
1 latch: cache buffers chains 884150708 150 0 0 -1 0 0
1 latch: cache buffers chains 884779988 150 0 0 -1 0 0
1 latch: cache buffers chains 884649516 150 0 0 -1 0 0
1 buffer busy waits 4 185927 1 0 78495 4 185927
1 buffer busy waits 4 185927 1 0 78495 4 185927 SESSION_ID NAME P1 P2 P3 WAIT_TIME CURRENT_OBJ# CURRENT_FILE# CURRENT_BLOCK#
---------- ------------------------------ ---------- ---------- ---------- ---------- ------------ ------------- --------------
33 latch: cache buffers chains 884779988 150 0 0 -1 0 0
1 latch: cache buffers chains 884779988 150 0 0 -1 0 0
33 latch: In memory undo latch 836651180 243 0 0 78495 4 185927
1 latch: cache buffers chains 884779988 150 0 0 -1 0 0
1 buffer busy waits 4 185927 1 0 78495 4 185927
33 buffer busy waits 4 185927 1 0 78495 4 185927
33 buffer busy waits 4 185927 1 0 78495 4 185927
1 latch: In memory undo latch 836651280 243 0 0 78495 4 185927
1 latch: cache buffers chains 884779988 150 0 0 -1 0 0
1 buffer busy waits 4 185927 1 0 78495 4 185927
33 latch: cache buffers chains 884709944 150 0 0 -1 0 0 SESSION_ID NAME P1 P2 P3 WAIT_TIME CURRENT_OBJ# CURRENT_FILE# CURRENT_BLOCK#
---------- ------------------------------ ---------- ---------- ---------- ---------- ------------ ------------- --------------
1 latch: cache buffers chains 884779988 150 0 0 -1 0 0
33 latch: In memory undo latch 836651180 243 0 0 78495 4 185927
33 latch: cache buffers chains 884862440 150 0 0 -1 0 0
1 latch: cache buffers chains 884779988 150 0 0 -1 0 0
1 latch: cache buffers chains 884779988 150 0 0 -1 0 0
1 buffer busy waits 4 185927 1 0 78495 4 185927
1 buffer busy waits 4 185927 1 0 78495 4 185927
33 latch: cache buffers chains 884779988 150 0 0 -1 0 0
33 db file sequential read 1 7802 1 0 40 1 7802
33 db file sequential read 1 57936 1 0 62 1 57936
1 db file sequential read 2 5549 1 0 -1 0 0 查看p1 p2参数 select owner,segment_name,segment_type from dba_extents
where file_id = 4 and 185927between block_id and block_id+blocks-1; SQL> SQL> 2 OWNER SEGMENT_NAME SEGMENT_TYPE
------------------------------ --------------------------------------------------------------------------------- ------------------
SCOTT TEST_DB TABLE

buffer busy wait的更多相关文章

  1. GC Buffer Busy Waits处理(转载)

    与单实例不同,在RAC环境中,由于多节点的原因,会因为节点间的资源争用产生GC类的等待,而这其中,GC Buffer Busy Waits又是最为常见的,从性能角度上说,RAC是把双刃剑,用的好,能够 ...

  2. buffer busy wait在RAC环境下出现

    昨天运维组的同时反映有套系统用户反映很慢,需要协助帮忙检查什么原因引起的性能问题.导出了从8点到11点的AWR报告进行分析,发现等待事件里大部分的指标都正常,就是buffer busy wait的平均 ...

  3. buffer busy waits

    Buffer busy waits 当会话想要访问缓冲区中的数据块,而该数据块正在被其他会话使用时将产生Buffer busy waits事件. 其他会话可能正从数据文件向缓冲器读取同样的数据块,或正 ...

  4. 模拟产生CBC LATCH与buffer busy wait等待事件

    数据库版本:11.2.0.4.0 1.查出表TEST相关信息 select rowid, dbms_rowid.rowid_row_number(rowid) rowid_rownum, dbms_r ...

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

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

  6. buffer cache —— buffer busy waits/read by other session

    oracle提供非常精确.有效的row level lock机制,多个用户同时修改数据时,为了保护数据,以块为单位挂起锁的情况不会发生.但这不太正确.以块为单位的锁虽然不存在,但正因为oracle I ...

  7. BUFFER CACHE之主要的等待事件

    原因:资源紧张,等待其释放. 原因的原因:1. lgwr和DBWn进程写太慢:2. Buffer和latch不可用 原因的原因的原因:全表扫描.library cache latches数太多等. 视 ...

  8. Buffer cache 的调整与优化

    Buffer cache 的调整与优化 -============================== -- Buffer cache 的调整与优化(一) --==================== ...

  9. Buffer lock

    buffer lock    Oracle 提供非常精确,有效的Row Level Lock机制,多个用户同时修改数据时,为了保护数据. 以块为单位挂起锁的情况不会发生,但这不太正确. 以块为单位的锁 ...

随机推荐

  1. hdu 2844

    本题的特殊性是价值与重量相等 将第i种物品分成若干件物品,其中每件物品有一个系数, 这件物品的费用和价值均是原来的费用和价值乘以这个系数. 使这些系数分别为1,2,4,…,2^(k-1),n[i]-2 ...

  2. Java基础知识强化23:Java中数据类型转换(面试题)

    1. 以下代码输出结果是( D ).                     public  class  Test   {                                       ...

  3. 大数据笔记01:大数据之Hadoop简介

    1. 背景 随着大数据时代来临,人们发现数据越来越多.但是如何对大数据进行存储与分析呢?   单机PC存储和分析数据存在很多瓶颈,包括存储容量.读写速率.计算效率等等,这些单机PC无法满足要求. 2. ...

  4. CentOS 7 修改hostname

    centOS 7 里面修改hostname的方式有所改变,修改/etc/hosts和/etc/sysconfig/network两个文件已经不能生效.使用的新命令是 : hostnamectl set ...

  5. jsp页面中定时的方法

    $(function(){ totaladd(); //定时时触发的函数 setInterval(totaladd,3000);//设置定时1000=1秒 }); function totaladd( ...

  6. MVC的Model层中的一些便签

    由于自己重新接触MVC,所以把Model层里的一些标签给记录下来,方便自己的使用. 这些是自己目前试用过的一些,在以后的工作中我会接着补充进去新的内容

  7. 使用JQuery获取对象的几种方式

    1.先讲讲JQuery的概念 JQuery首先是由一个 America 的叫什么 John Resig的人创建的,后来又很多的JS高手也加入了这个团队.其实 JQuery是一个JavaScript的类 ...

  8. parent.location.href和location.href区别

    parent.location.href='ind.php'parent用于框架结构,需要全网页转向如果你的网页是左右框架,那么,直接把当前页面全部转到ind.php中 location.href=' ...

  9. Android Studio 将工程作为第三方类库的步骤

    一.将工程的module名称修改为自己要添加的类库名称 1.选中module文件夹右键到Rename项 2.选中Rename module项 3.修改为自己的名称,如VolleyLibary 二.修改 ...

  10. Linux误删C基本运行库libc.so.6急救方法

    首先普及一下关于libc.so.6的基本常识: libc.so.6是glibc的软链接 ll  /lib64/libc.so.6lrwxrwxrwx 1 root root 11 Aug 27 201 ...