[20170821]使用oradebug模拟Cache Buffers chains(10g).txt
--//上午测试了在读读模式下,不会出现Cache Buffers chains等待时间,链接http://blog.itpub.net/267265/viewspace-2143880/
--//下午在10g下使用oradebug模拟看看是否会出现Cache Buffers chains.
1.环境:
SCOTT@test> @ &r/ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- ----------------------------------------------------------------
x86_64/Linux 2.4.xx 10.2.0.4.0 Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
SCOTT@test> select * from emp where rowid='AAAMlsAAEAAAAAgAAA';
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
7369 SMITH CLERK 7902 1980-12-17 00:00:00 800 20
SCOTT@test> @ &r/rowid AAAMlsAAEAAAAAgAAA
OBJECT FILE BLOCK ROW ROWID_DBA DBA TEXT
---------- ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------
51564 4 32 0 0x1000020 4,32 alter system dump datafile 4 block 32 ;
SYS@test> @ &r/bh 4 32
HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA OBJECT_NAME
---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- --------------------
000000007C3CE308 4 32 1 data block xcur 8 0 0 0 0 0 0000000063866000 EMP
2.测试1:
SYS@test> oradebug setmypid
Statement processed.
SYS@test> oradebug peek 0x000000007C3CE308 16
[07C3CE308, 07C3CE318) = 00000000 00000000 00008277 0000007A
SYS@test> oradebug poke 0x000000007C3CE308 4 1
BEFORE: [07C3CE308, 07C3CE30C) = 00000000
AFTER: [07C3CE308, 07C3CE30C) = 00000001
SCOTT@test> select * from emp where rowid='AAAMlsAAEAAAAAgAAA';
....挂起!!
SYS@test> select p1raw,p2raw,p3raw,p1,p2,p3,sid,serial#,seq#,event,state,seconds_in_wait from v$session where wait_class<>'Idle';
P1RAW P2RAW P3RAW P1 P2 P3 SID SERIAL# SEQ# EVENT STATE SECONDS_IN_WAIT
---------------- ---------------- ---------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------------------------------- ---------- ---------------
000000007C3CE308 000000000000007A 00 2084365064 122 0 139 13287 40 latch: cache buffers chains WAITING 15
SYS@test> @ &r/wait10g
P1RAW P2RAW P3RAW P1 P2 P3 SID SERIAL# SEQ# EVENT STATE WAIT_TIME SECONDS_IN_WAIT
---------------- ---------------- ---------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------------------------------- ---------- ---------- ---------------
000000007C3CE308 000000000000007A 00 2084365064 122 0 139 13287 40 latch: cache buffers chains WAITING 0 21
--//可见10g下,只要设置前面4位就可以导致出现latch: cache buffers chains.
--//peek 联想 绑定变量peek. poke=>修改.
--//而11g这样设置无效!!说明在10g下读读模式会出现latch: cache buffers chains.等待事件.
SYS@test> oradebug poke 0x000000007C3CE308 4 0
BEFORE: [07C3CE308, 07C3CE30C) = 00000001
AFTER: [07C3CE308, 07C3CE30C) = 00000000
SCOTT@test> select * from emp where rowid='AAAMlsAAEAAAAAgAAA';
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
7369 SMITH CLERK 7902 1980-12-17 00:00:00 800 20
3.测试2:
SYS@test> oradebug poke 0x000000007C3CE308 8 1
BEFORE: [07C3CE308, 07C3CE310) = 00000000 00000000
AFTER: [07C3CE308, 07C3CE310) = 00000001 00000000
SCOTT@test> select * from emp where rowid='AAAMlsAAEAAAAAgAAA' ;
...
--//挂起!!
SYS@test> oradebug peek 0x000000007C3CE308 16
[07C3CE308, 07C3CE318) = 00000001 40000000 00008283 0000007A
~~~~~~~~~~~~~~~~~
--//注意下划线部分...
SYS@test> oradebug poke 0x000000007C3CE308 4 0
BEFORE: [07C3CE308, 07C3CE30C) = 00000001
AFTER: [07C3CE308, 07C3CE30C) = 00000000
SCOTT@test> select * from emp where rowid='AAAMlsAAEAAAAAgAAA' ;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
7369 SMITH CLERK 7902 1980-12-17 00:00:00 800 20
SYS@test> oradebug peek 0x000000007C3CE308 16
[07C3CE308, 07C3CE318) = 00000000 00000000 0000828B 0000007A
--//对比可以发现全部变成0.