[20161214]关于Buffer Busy Waits.txt

[20161214]关于Buffer Busy Waits.txt

--oracle一直在不断的改进,oracle对外宣传总是读写不会相互阻塞,实际上从内部看读读不会阻塞,写写一定会出现阻塞,
--如果读写呢? 实际上写入会阻塞读取操作,这个时候读取会出现等待(以前我一直以为这时写入进程会话会出现等待事件Buffer Busy
--Waits,实际上存在很大的错误!!),等待事件就是Buffer Busy Waits,还是通过测试来讲解.

1.环境:
SCOTT@book> @ &r/ver1

PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SCOTT@book> create table t1 as select rownum id,'test' name from dual connect by level<=2;
Table created.

SCOTT@book> select rowid,t1.* from t1;
ROWID               ID NAME
------------------ --- ------
AAAVpIAAEAAAAILAAA   1 test
AAAVpIAAEAAAAILAAB   2 test

2.建立测试脚本:
$ cat a.sql
declare
    j number;
begin
for i in 1..1e7 loop
    select id into j from t1 where rowid='AAAVpIAAEAAAAILAAA';
end loop;
end;
/

$ cat b.sql
begin
for i in 1..1e5 loop
    update t1 set name='test' where rowid='AAAVpIAAEAAAAILAAB';
    commit;
end loop;
end;
/

--打开2个会话分别执行:
--会话1:
SCOTT@book(56,1139)>
SCOTT@book(56,1139)> @a.sql

--会话2:
SCOTT@book(68,697)>
SCOTT@book(68,697)> @ b.sql

SCOTT@book> @ &r/wait
P1RAW            P2RAW            P3RAW                    P1         P2         P3        SID    SERIAL#       SEQ# EVENT                                    STATE               WAIT_TIME_MICRO SECONDS_IN_WAIT
---------------- ---------------- ---------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------------------------------- ------------------- --------------- ---------------
0000000062657100 0000000000000001 00               1650815232          1          0         46        969         81 SQL*Net message to client                WAITED SHORT TIME                 2               0
0000000000000004 000000000000020B 0000000000000001          4        523          1         56       1139      15212 buffer busy waits                        WAITED SHORT TIME                 2               0
00               00               00                        0          0          0         68        697         34 log file switch (checkpoint incomplete)  WAITED SHORT TIME               418               2

SCOTT@book> @ &r/wait
P1RAW            P2RAW            P3RAW                    P1         P2         P3        SID    SERIAL#       SEQ# EVENT                                    STATE               WAIT_TIME_MICRO SECONDS_IN_WAIT
---------------- ---------------- ---------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------------------------------- ------------------- --------------- ---------------
0000000000000001 0000000000000100 00000000FFFFFFFF          1        256 4294967295        254          3      23917 Log archive I/O                          WAITING                         337               0
0000000062657100 0000000000000001 00               1650815232          1          0         46        969        105 SQL*Net message to client                WAITED SHORT TIME                 2               0
0000000000000004 000000000000020B 0000000000000001          4        523          1         56       1139       9237 buffer busy waits                        WAITED SHORT TIME                 2               0
00               00               00                        0          0          0         68        697         44 log file switch completion               WAITED SHORT TIME               458               0

--出现等待事件buffer busy waits 的session是(sid,serial#)=(56,1139),正好执行的是大量读取的操作.

SCOTT@book> select * from v$event_name where lower(name) like lower('buffer busy waits');
EVENT#   EVENT_ID NAME              PARAMETER1           PARAMETER2           PARAMETER3           WAIT_CLASS_ID WAIT_CLASS# WAIT_CLASS
------ ---------- ----------------- -------------------- -------------------- -------------------- ------------- ----------- --------------------
    95 2161531084 buffer busy waits file#                block#               class#                  3875070507           4 Concurrency

SCOTT@book> @ &r/rowid AAAVpIAAEAAAAILAAB
    OBJECT       FILE      BLOCK        ROW ROWID_DBA            DBA                  TEXT
---------- ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------
     88648          4        523          1  0x100020B           4,523                alter system dump datafile 4 block 523 ;

--至于P3=1 class#表示什么,估计数据块有类型.

http://www.juliandyke.com/Internals/BlockClasses.php

Block
Class    Description
    1    Data block
    2    Sort block
    3    Save undo block
    4    Segment header
    5    Save undo header
    6    Free list
    7    Extent map
    8    1st level bitmap block
    9    2nd level bitmap block
   10    3rd level bitmap block
   11    Bitmap block
   12    Bitmap index block
   13    File header block
   14    Unused
   15    System undo block
   16    System undo block
   17    Undo header
   18    Undo block

时间: 2024-10-23 10:22:18

[20161214]关于Buffer Busy Waits.txt的相关文章

[20150122]buffer busy waits特例.txt

[20150122]buffer busy waits特例.txt --oracle 里有句名言:读不阻塞写,写阻塞读. --如果读读模式,是否会出现buffer busy waits呢?通过例子来说明: 1.建立测试环境: SCOTT@test> @ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- --------------------

如何模拟产生CBC LATCH与buffer busy wait等待事件

数据库版本:Oracle 11.2.0.4.0 CBC latch出现的原因:   --只在逻辑读时产生 1.CBC latch保护不同的链表.不同BH   :同一LATCH下多个BUCKET被同时访问时,(一个LATCH对应多个BUCKET) 2.CBC latch保护同一链表下同一BH  :同一LATCH下同一BH被同时访问时 latch: cache buffers chains 解决方法: 1._db_block_hash_latches加大latch数量,作用是减少同一LATCH下多个

buffer cache实验7:buffer busy waits-完成

1.buffer busy waits产生原理分析: 一次逻辑读时CBC latch锁及Buffer pin锁的获取和释放过程如下: 1.加Latch X 2.进入hash chain,在相应的BH上加Buffer pin S (0-->1) 3.释放Latch X 4.进行逻辑读--也就是通过BH中的buffer adderss找到数据块在内存中真实位置  ---假如读了1MS 5.加Latch X 6.释放Buffer pin S (1-->0)  0:没锁  1:共享锁 -SELECT

gc buffer busy

前段时间有一套RAC系统偶然会出现负载异常升高的情况,后来查出来跟节点内部通信有关系,之后升级RAC系统的网卡驱动,其中一个节点重启,另一个节点通过rmmod,modprobe加载新的网卡驱动,导致混合连接,gc buffer busy频繁 : SQL> select INST_ID,username,count(*) from gv$session group by inst_id,username order by INST_ID,username; INST_ID USERNAME COU

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

  以下内容太整理自网络,完全处于学习目的,如有侵权请及时联系我,我会立即删除.   非空闲等待之:buffer busy waits 事件参数说明: 事件号 事件名 参数一 参数二 参数三 145 buffer busy waits file# block# 9i - 原因码 10g - block class# ORACLE会话正在等待PIN住一个缓冲区,会话必须在读取或修改缓冲区之前将该缓冲区PIN住. 在任何时侯只有一个进程可以PIN住一个缓冲区. buffer busy waits表明

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

概述---------------------gc buffer busy是RAC数据库中常见的等待事件,11g开始gc buffer  busy分为gc buffer busy acquire和gc buffer  busy release. gc buffer busy acquire是当session#1尝试请求访问远程实例(remote  instance) buffer,但是在session#1之前已经有相同实例上另外一个session#2请求访问了相同的buffer,并且没有完成,那

分析解决11gR2 双节点RAC环境下的gc cr block busy/gc buffer busy acquire等待

?  系统环境 两节点的RAC:AIX6.1+Oracle 11.2.0.3.3   ?  AWR里展示出来的各种症状(数据来自实例2) 虽然应用没有报障,但AWR报告里的各种迹象已经很明显了 (1)     gc buffer busy acquire排进了Top 5 Timed Foreground Events 图-1     (2)     除去DB CPU在gc buffer busy acquire之后的就是gc cr block busy了 图-2     (3)     2h21

[20171105]exp imp buffer参数解析.txt

[20171105]exp imp buffer参数解析.txt oracle官方所给的关于buffer的解释如下: https://docs.oracle.com/cd/A84870_01/doc/server.816/a76955/ch01.htm BUFFER Default: operating system-dependent. See your Oracle operating system-specific documentation to determine the defaul

等待模拟-BUFFER BUSY WAIT

create table test_buf(id number,name char(1000)) tablespace test; begin   for idx in 1..100 loop  insert into test_buf values(idx,'aa');  end loop; end; select dbms_rowid.rowid_relative_fno(rowid),dbms_rowid.rowid_block_number(rowid),count(*) from te