[20181122]bbed人为修改事务提交标志.txt
--//做一个bbed人为修改事务提交标志的测试,感觉这东西要经常练习,不做有点生疏.
1.环境:
SCOTT@book> @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
create table deptx as select * from dept;
SCOTT@book> select rowid,deptx.* from deptx where rownum=1;
ROWID DEPTNO DNAME LOC
------------------ ---------- -------------- -------------
AAAWFdAAEAAAAIzAAA 10 ACCOUNTING NEW YORK
SCOTT@book> @ rowid AAAWFdAAEAAAAIzAAA
OBJECT FILE BLOCK ROW ROWID_DBA DBA TEXT
---------- ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------
90461 4 563 0 0x1000233 4,563 alter system dump datafile 4 block 563 ;
2.测试:
--//session 1:
SCOTT@book> update deptx set dname=lower(dname) where deptno=10;
1 row updated.
--//session 2:
SCOTT@book> alter system flush buffer_cache;
System altered.
3.bbed人为修改事务提交标志:
BBED> set dba 4,563
DBA 0x01000233 (16777779 4,563)
BBED> x /rncc *kdbr[0]
rowdata[66] @8162
-----------
flag@8162: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8163: 0x02
cols@8164: 3
col 0[2] @8165: 10
col 1[10] @8168: accounting
col 2[8] @8179: NEW YORK
--//使用事务槽2.从0开始编号.
BBED> p ktbbh.ktbbhitl[1]
struct ktbbhitl[1], 24 bytes @68
struct ktbitxid, 8 bytes @68
ub2 kxidusn @68 0x000a
ub2 kxidslt @70 0x001c
ub4 kxidsqn @72 0x000051d4
struct ktbituba, 8 bytes @76
ub4 kubadba @76 0x00c00117
ub2 kubaseq @80 0x0f93
ub1 kubarec @82 0x24
ub2 ktbitflg @84 0x0001 (NONE)
union _ktbitun, 2 bytes @86
sb2 _ktbitfsc @86 0
ub2 _ktbitwrp @86 0x0000
ub4 ktbitbas @88 0x00000000
BBED> assign ktbbh.ktbbhitl[1].ktbitflg=0x8000
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
ub2 ktbitflg @84 0x8000 (KTBFCOM)
BBED> assign offset 8163=0x00
ub1 rowdata[0] @8163 0x00
BBED> x /rncc *kdbr[0]
rowdata[66] @8162
-----------
flag@8162: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8163: 0x00
cols@8164: 3
col 0[2] @8165: 10
col 1[10] @8168: accounting
col 2[8] @8179: NEW YORK
BBED> sum apply ;
Check value for File 4, Block 563:
current = 0xb7ca, required = 0xb7ca
3.打开新的会话:
--//session 2:
SCOTT@book> select rowid,deptx.* from deptx where rownum=1;
ROWID DEPTNO DNAME LOC
------------------ ---------- -------------- -------------
AAAWFdAAEAAAAIzAAA 10 accounting NEW YORK
--//可以发现dname变成小写.看见没有提交的事务.
--//回到session 1:
SCOTT@book> rollback;
Rollback complete.
SCOTT@book> select rowid,deptx.* from deptx where rownum=1;
ROWID DEPTNO DNAME LOC
------------------ ---------- -------------- -------------
AAAWFdAAEAAAAIzAAA 10 ACCOUNTING NEW YORK
--//不过rollback,有回来了.
--//回到session 2:
SCOTT@book> select rowid,deptx.* from deptx where rownum=1;
ROWID DEPTNO DNAME LOC
------------------ ---------- -------------- -------------
AAAWFdAAEAAAAIzAAA 10 ACCOUNTING NEW YORK
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-2221174/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/267265/viewspace-2221174/