场景1
表t3
SQL> select * from t3; ID NAME ---------- -------------------- 1 aaa 2 bbbb
SQL> update t3 set name='cccc' where name='bbbb'; ###这里更新值长度相同 1 row updated. SQL> commit; Commit complete. SQL> alter system flush buffer_cache; System altered.
BBED> set file 5 block 2207 FILE# 5 BLOCK# 2207 BBED> dump /v offset 8000 count 200 File: /u01/app/oracle/oradata/orcl/test01.dbf (5) Block: 2207 Offsets: 8000 to 8191 Dba:0x0140089f ------------------------------------------------------- 46004700 48004900 4a004b00 4c004d00 l F.G.H.I.J.K.L.M. 4e004f00 50005100 52005300 54005500 l N.O.P.Q.R.S.T.U. 56005700 58005900 5a005b00 5c005d00 l V.W.X.Y.Z.[.\.]. 5e005f00 60006100 62006300 64006500 l ^._.`.a.b.c.d.e. 66006700 68006900 6a006b00 6c006d00 l f.g.h.i.j.k.l.m. 6e006f00 70007100 72007300 74007500 l n.o.p.q.r.s.t.u. 76007700 78007900 7a007b00 7c007d00 l v.w.x.y.z.{.|.}. 7e007f00 80008100 82008300 84008500 l ~............... 86008700 88008900 8a008b00 8c008d00 l ................ 8e008f00 90009100 92009300 94009500 l ................ 96009700 9800902c 020202c1 03046363 l .......,..cc 63632c00 0202c102 03616161 0106c52c l cc,...aaa..ì ####把bbbb的值更新为cccc 2c1030463636363---cccc 2c10203616161--aaa BBED> p kdbr sb2 kdbr[0] @118 8078 sb2 kdbr[1] @120 8067 BBED> p *kdbr[1] rowdata[0] ---------- ub1 rowdata[0] @8167 0x2c BBED> x/rncccccc rowdata[0] @8167 =8067+100 ---------- flag@8167: 0x2c (KDRHFL, KDRHFF, KDRHFH) lock@8168: 0x02 cols@8169: 2 col 0[2] @8170: 2 col 1[4] @8173: cccc ####把bbbb的值更新为cccc
更新前后值的长度相同,在原位置进行更新
例2 修改值之后的长度大于之前的值长度
SQL> select * from t3; ID NAME ---------- -------------------- 1 aaa 2 cccc SQL> update t3 set name='dddddd' where name='cccc'; ###更新的值的长度变长 1 row updated. SQL> commit; Commit complete. SQL> alter system flush buffer_cache; System altered.
BBED> set file 5 block 2207 FILE# 5 BLOCK# 2207 BBED> p kdbr sb2 kdbr[0] @118 8078 sb2 kdbr[1] @120 8054 BBED> p *kdbr[1] rowdata[0] ---------- ub1 rowdata[0] @8154 0x2c BBED> x/rncccccc rowdata[0] @8154 ---------- flag@8154: 0x2c (KDRHFL, KDRHFF, KDRHFH) lock@8155: 0x01 cols@8156: 2 col 0[2] @8157: 2 ###id=2 col 1[6] @8160: dddddd ##值更新为dddddd BBED> dump /v offset 8000 count 200 File: /u01/app/oracle/oradata/orcl/test01.dbf (5) Block: 2207 Offsets: 8000 to 8191 Dba:0x0140089f ------------------------------------------------------- 46004700 48004900 4a004b00 4c004d00 l F.G.H.I.J.K.L.M. 4e004f00 50005100 52005300 54005500 l N.O.P.Q.R.S.T.U. 56005700 58005900 5a005b00 5c005d00 l V.W.X.Y.Z.[.\.]. 5e005f00 60006100 62006300 64006500 l ^._.`.a.b.c.d.e. 66006700 68006900 6a006b00 6c006d00 l f.g.h.i.j.k.l.m. 6e006f00 70007100 72007300 74007500 l n.o.p.q.r.s.t.u. 76007700 78007900 7a007b00 7c007d00 l v.w.x.y.z.{.|.}. 7e007f00 80008100 82008300 84008500 l ~............... 86008700 88008900 8a008b00 8c008d00 l ................ 8e008f00 90009100 92002c01 0202c103 l ..........,.. 06646464 6464642c 000202c1 03046363 l .dddddd,...cc ###这里cccc的值还在,新的值dddddd放在后面的位置 63632c00 0202c102 03616161 0106462d l cc,...aaa..F- <16 bytes per line> SQL> select dump('d','16') from dual; DUMP('D','16') ---------------- Typ=96 Len=1: 64 SQL> select * from t3; ID NAME ---------- -------------------- 1 aaa 2 dddddd 2c10306646464646464---dddddd ###新增加记录 2c1030463636363---cccc ###修改之后,这个值没变 2c10203616161 ---aaa
测试通过bbed把dddddd的值修改回ccccc,而不使用update命令
原来cccc的位置 SQL> select to_char(8067,'xxxxxxxxxxxxxx') from dual; TO_CHAR(8067,'X --------------- 1f83 SQL> select to_char(8054,'xxxxxxxxxx') from dual; TO_CHAR(805 ----------- 1f76 新值dddddd的位置 76,修改为旧值cccc位置83 BBED> modify /x 83 offset 120 Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y File: /u01/app/oracle/oradata/orcl/test01.dbf (5) Block: 2207 Offsets: 120 to 319 Dba:0x0140089f ------------------------------------------------------------------------ 831f0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <32 bytes per line> BBED> sum apply Check value for File 5, Block 2207: current = 0x2191, required = 0x2191
修改事务槽
BBED> dump /v offset 8168 File: /u01/app/oracle/oradata/orcl/test01.dbf (5) Block: 2207 Offsets: 8168 to 8191 Dba:0x0140089f ------------------------------------------------------- 000202c1 03046363 63632c00 0202c102 l ...cccc,.. ####cccc事务槽位00 03616161 0106462d l .aaa..F- <16 bytes per line> BBED> dump /v offset 8155 File: /u01/app/oracle/oradata/orcl/test01.dbf (5) Block: 2207 Offsets: 8155 to 8191 Dba:0x0140089f ------------------------------------------------------- 010202c1 03066464 64646464 2c000202 l ...dddddd,... ####dddddd事务槽的值为01 c1030463 6363632c 000202c1 02036161 l.cccc,...aa 61010646 2d l a..F- <16 bytes per line> BBED> modify /x 00 offset 8155 ##修改dddddd事务槽为00 File: /u01/app/oracle/oradata/orcl/test01.dbf (5) Block: 2207 Offsets: 8155 to 8191 Dba:0x0140089f ------------------------------------------------------------------------ 000202c1 03066464 64646464 2c000202 c1030463 6363632c 000202c1 02036161 61010646 2d <32 bytes per line> BBED> sum apply Check value for File 5, Block 2207: current = 0x2091, required = 0x2091 BBED> modify /x 01 offset 8168 ##修改cccc事务槽为01 File: /u01/app/oracle/oradata/orcl/test01.dbf (5) Block: 2207 Offsets: 8168 to 8191 Dba:0x0140089f ------------------------------------------------------------------------ 010202c1 03046363 63632c00 0202c102 03616161 0106462d <32 bytes per line> BBED> sum apply Check value for File 5, Block 2207: current = 0x2090, required = 0x2090
有效空间设置(这一块的值和位置没有搞明白)
BBED> modify /x 5c offset 110 File: /u01/app/oracle/oradata/orcl/test01.dbf (5) Block: 2207 Offsets: 110 to 309 Dba:0x0140089f ------------------------------------------------------------------------ 5c1f6b1f 00000200 8e1f831f 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <32 bytes per line> BBED> modify /x 5c offset 112 File: /u01/app/oracle/oradata/orcl/test01.dbf (5) Block: 2207 Offsets: 112 to 311 Dba:0x0140089f ------------------------------------------------------------------------ 5c1f0000 02008e1f 831f0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <32 bytes per line> BBED> sum apply Check value for File 5, Block 2207: current = 0x2090, required = 0x2090 BBED> verify DBVERIFY - Verification starting FILE = /u01/app/oracle/oradata/orcl/test01.dbf BLOCK = 2207 Block Checking: DBA = 20973727, Block Type = KTB-managed data block data header at 0x7f7c53a15264 kdbchk: the amount of space used is not equal to block size used=43 fsc=0 avsp=8028 dtl=8088 Block 2207 failed with check code 6110 DBVERIFY - Verification complete Total Blocks Examined : 1 Total Blocks Processed (Data) : 1 Total Blocks Failing (Data) : 1 Total Blocks Processed (Index): 0 Total Blocks Failing (Index): 0 Total Blocks Empty : 0 Total Blocks Marked Corrupt : 0 Total Blocks Influx : 0 Message 531 not found; product=RDBMS; facility=BBED
SQL> alter system flush buffer_cache; System altered. SQL> select * from t3; ##没有使用update命令,只用bbed把dddddd的值修改回cccc ID NAME ---------- -------------------- 1 aaa 2 cccc