Oracle之BBED之(二)-----BBED更改数据块

时间:2022-03-25 07:27:34

本次修改测试环境

SQL> select * from test01;


ID NAME
---------- ------------------------------
1 AAAAAAA
2 BBBBBB
3 CCCCCC

本次通过修改test01表中的BBBBBB选项

根据ORACLE之BBED之(一)使用BBED dump数据文件

BBED> dump
 File: /u01/app/oracle/oradata/Oracle10g/test01.dbf (6)
 Block: 12               Offsets:    0 to 8191           Dba:0x0180000c
------------------------------------------------------------------------
 06a20000 0c008001 1c8e0600 00000206 b7560000 01000000 cace0000 198e0600 
 00000000 02003200 09008001 04002100 0a010000 2d058000 d5001d00 00800000 
 c5880600 02000400 f3000000 1e008000 cf002500 01200000 1c8e0600 00000000 
 00000000 00010300 ffff1800 631f581f 581f0000 0300631f 7e1f711f 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 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 0000002c 020202c1 02074141 41414141 412c0002 02c10406 43434343 
 43432c00 0202c103 06424242 4242422c 000202c1 02064141 41414141 02061c8e 


 <32 bytes per line>

BBED修改数据块(设置模式为edit

 

BBED> set modeedit

MODE                  Edit

1)确定修改的字节

BBED> help find

FIND[/x|d|u|o|c]numeric/character string [ TOP | CURR ]

说明:x使用十六进制进行寻找  d使用十进制进行寻找 c使用字符串进行寻找

 

BBED> find /cBBBBBB

 File:/u01/app/oracle/oradata/Oracle10g/test01.dbf (6)

 Block: 12               Offsets: 8169 to 8191           Dba:0x0180000c

------------------------------------------------------------------------

 42424242 42422c00 0202c102 06414141 41414102061c8e

 

 <32 bytes per line>

BBED> show all

FILE#                 6

BLOCK#                12

OFFSET                8169偏移量在find之后会自己更改

DBA                   0x0180000c (251658366,12)

FILENAME              /u01/app/oracle/oradata/Oracle10g/test01.dbf

BIFILE                bifile.bbd

LISTFILE              /home/oracle/bbed.list

BLOCKSIZE             8192

MODE                  Browse

EDIT                  Unrecoverable

IBASE                 Dec

OBASE                 Dec

WIDTH                 80

COUNT                 8192

LOGFILE               log.bbd

SPOOL                 No

若是再重新查找则需要把偏移量重新设置,这时候如果dumpdump偏移量后面的数据

BBED> dump

 File:/u01/app/oracle/oradata/Oracle10g/test01.dbf (6)

 Block: 12               Offsets: 8169 to 8191           Dba:0x0180000c

------------------------------------------------------------------------

 42424242 42422c00 0202c102 06414141 41414102061c8e

 

 <32 bytes per line>

修改数据:

MODIFY[/x|d|u|o|c]numeric/character string

      [ DBA | FILE | FILENAME | BLOCK | OFFSET| symbol | *symbol ]

BBED> modify /cDDDDDD

 File:/u01/app/oracle/oradata/Oracle10g/test01.dbf (6)

 Block: 12               Offsets: 8169 to 8191           Dba:0x

---------------------------------------------------------------

 44444444 44442c00 0202c102 06414141 41414102061c8e

 

 <32 bytes per line>

修改校验值

BBED>sum apply

Check value for File6, Block 12:

current = 0x50b1,required = 0x50b1

刷新一下缓存

SQL> alter systemflush buffer_cache;

 

System altered.

查看修改结果:

SQL> select *from test01;

 

IDNAME

----------------------------------------

 1 AAAAAAA

 2 DDDDDD

 3 CCCCCC