bbed可以直接修改block上的内容
模拟环境:
SQL> select * from goolen;
ID NAME
---------- --------------------
1 GOOLEN
2 ORACLE
SQL> select
2 dbms_rowid.rowid_relative_fno(rowid) file_number,
3 dbms_rowid.rowid_block_number(rowid) block_number,
4 id,name
5 from goolen;
FILE_NUMBER BLOCK_NUMBER ID NAME
----------- ------------ ---------- --------------------
4 172 1 GOOLEN
4 172 2 ORACLE
--我们把id=1的这一列,name值改为ORACLE
[oracle@localhost bbed]$ bbed parfile=bbed.par
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Thu Oct 24 10:17:18 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> info
File# Name Size(blks)
----- ---- ----------
1 /opt/app/oracle/oradata/goolen/system01.dbf 87040
2 /opt/app/oracle/oradata/goolen/sysaux01.dbf 71680
3 /opt/app/oracle/oradata/goolen/undotbs01.dbf 3840
4 /opt/app/oracle/oradata/goolen/users01.dbf 7040
BBED> set dba 4,172
DBA 0x010000ac (16777388 4,172)
--/c 直接查找字符串,确定这一行在block中的偏移量offset
BBED> f /c GOOLEN
File: /opt/app/oracle/oradata/goolen/users01.dbf (4)
Block: 172 Offsets: 8182 to 8191 Dba:0x010000ac
------------------------------------------------------------------------
474f4f4c 454e0206 5fd4
<32 bytes per line>
--dump查看具体的内容
BBED> d /v dba 4,172 offset 8182 count 32
File: /opt/app/oracle/oradata/goolen/users01.dbf (4)
Block: 172 Offsets: 8182 to 8191 Dba:0x010000ac
-------------------------------------------------------
474f4f4c 454e0206 5fd4 l GOOLEN.._?
<16 bytes per line>
--修改
BBED> modify /c ORACLE dba 4,172 offset 8182
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /opt/app/oracle/oradata/goolen/users01.dbf (4)
Block: 172 Offsets: 8182 to 8191 Dba:0x010000ac
------------------------------------------------------------------------
4f524143 4c450206 5fd4
<32 bytes per line>
--再次dump查看内容
BBED> d /v dba 4,172 offset 8182 count 32
File: /opt/app/oracle/oradata/goolen/users01.dbf (4)
Block: 172 Offsets: 8182 to 8191 Dba:0x010000ac
-------------------------------------------------------
4f524143 4c450206 5fd4 l ORACLE.._?
<16 bytes per line>
BBED> sum apply
Check value for File 4, Block 172:
current = 0xe3c7, required = 0xe3c7
--刷新,查看表数据
SQL> alter system flush buffer_cache;
System altered.
--数据已经被更改
SQL> select rowid,g.* from goolen g;
ROWID ID NAME
------------------ ---------- --------------------
AAASNRAAEAAAACsAAA 1 ORACLE
AAASNRAAEAAAACsAAB 2 ORACLE
--回滚所有操作
BBED> revert
All changes made in this session will be rolled back. Proceed? (Y/N) y
Reverted file '/opt/app/oracle/oradata/goolen/users01.dbf', block 172
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
BBED>
--再次刷新
SQL> alter system flush buffer_cache;
System altered.
SQL> select rowid,g.* from goolen g;
ROWID ID NAME
------------------ ---------- --------------------
AAASNRAAEAAAACsAAA 1 GOOLEN
AAASNRAAEAAAACsAAB 2 ORACLE
SQL>
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23249684/viewspace-1155841/
,如需转载,请注明出处,否则将追究法律责任。