使用bbed修改内容
环境:
OS:Centos 7
DB:11.2.0.4
1.表数据内容
SQL> select * from bbed;
ID NAME
---------- --------------------
1 hxl
2 hxl02
2.获取数据内容的块信息
select
rowid,
dbms_rowid.rowid_relative_fno(rowid)rel_fno,
dbms_rowid.rowid_block_number(rowid)blockno,
dbms_rowid.rowid_row_number(rowid) rowno
from bbed;
ROWID REL_FNO BLOCKNO ROWNO
------------------ ---------- ---------- ----------
AAAVbBAAFAAApGFAAA 5 168325 0
AAAVbBAAFAAApGFAAB 5 168325 1
3.查找关键字hxl,确定其在block中的偏移量offset.
BBED> set dba 5,168325 offset 0
DBA 0x01429185 (21139845 5,168325)
OFFSET 0
BBED> find /c hxl
File: /u01/app/oracle/oradata/ora11g/tps_hxl01.dbf (5)
Block: 168325 Offsets: 8173 to 8191 Dba:0x01429185
------------------------------------------------------------------------
68786c30 322c0102 02c10203 68786c01 06080d
<32 bytes per line>
注意这里查找是从后面开始查找起来的,那么这样的话查找的是hxl02这条纪录.
4.dump查看具体内容
BBED> dump /v dba 5,168325 offset 8173 count 128
File: /u01/app/oracle/oradata/ora11g/tps_hxl01.dbf (5)
Block: 168325 Offsets: 8173 to 8191 Dba:0x01429185
-------------------------------------------------------
68786c30 322c0102 02c10203 68786c01 l hxl02,...á..hxl.
06080d l ...
<16 bytes per line>
5.修改block,将hxl 换成jjf
BBED> modify /c 'jjf' dba 5,168325 offset 8173
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /u01/app/oracle/oradata/ora11g/tps_hxl01.dbf (5)
Block: 168325 Offsets: 8173 to 8191 Dba:0x01429185
------------------------------------------------------------------------
68786c20 322c0102 02c10203 68786c01 06080d
<32 bytes per line>
查看内容
BBED> dump /v dba 5,168325 offset 8173 count 128
File: /u01/app/oracle/oradata/ora11g/tps_hxl01.dbf (5)
Block: 168325 Offsets: 8173 to 8191 Dba:0x01429185
-------------------------------------------------------
6a6a6630 322c0102 02c10203 68786c01 l jjf02,...á..hxl.
06ba0f l .o.
<16 bytes per line>
6.应用变更
BBED> sum dba 5,168325
Check value for File 5, Block 168325:
current = 0xf89b, required = 0xf089
BBED> sum dba 5,168325 apply
Check value for File 5, Block 168325:
current = 0xf089, required = 0xf089
7.sql模式执行如下命令
SQL> alter system flush buffer_cache;
8.确认修改
SQL> select * from bbed;
ID NAME
---------- --------------------
1 hxl
2 jjf02