1.环境准备
SYS@ORCL>select * from hr.test;
ID NAME
----- --------------------
1 red
2 green
SYS@ORCL>delete from hr.test where id=1;
1 row deleted.
SYS@ORCL>commit;
Commit complete.
2.查找test表中数据所在的物理位置
SYS@ORCL>select rowid,dbms_rowid.rowid_relative_fno(rowid) "fno",
2 dbms_rowid.rowid_block_number(rowid) "blockno",
3 dbms_rowid.rowid_row_number(rowid) "rowno" from hr.test;
ROWID fno blockno rowno
------------------ ---------- ---------- ----------
AAACe7AAEAAAJ0KAAD 4 40202 3
3.利用bbed来恢复数据(用BBED之前,最好关闭数据库)
[oracle@WZY lib]$ ./bbed parfile=/home/oracle/wzy/bbed.par
BBED: Release 2.0.0.0.0 - Limited Production on Thu Sep 25 19:07:54 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> set dba 4,40202
DBA 0x01009d0a (16817418 4,40202)
BBED> find /c red
File: /u01/app/oracle/oradata/ORCL/disk1/example.dbf (4)
Block: 40202 Offsets: 8185 to 8191 Dba:0x01009d0a
------------------------------------------------------------------------
72656401 06b359
<32 bytes per line>
BBED> dump /v offset 8185
File: /u01/app/oracle/oradata/ORCL/disk1/example.dbf (4)
Block: 40202 Offsets: 8185 to 8191 Dba:0x01009d0a
-------------------------------------------------------
72656401 06b359 l red..�Y
<16 bytes per line>
BBED> p *kdbr
rowdata[36]
-----------
ub1 rowdata[36] @8178 0x3c
BBED> set offset 8178
OFFSET 8178
BBED> m /x 2c
File: /u01/app/oracle/oradata/ORCL/disk1/example.dbf (4)
Block: 40202 Offsets: 8178 to 8191 Dba:0x01009d0a
------------------------------------------------------------------------
2c010202 c1020372 65640106 b359
<32 bytes per line>
BBED> sum apply
Check value for File 4, Block 40202:
current = 0x2915, required = 0x2915
4.到数据库中查看结果
SYS@ORCL>alter system flush buffer_cache;
System altered.
SYS@ORCL>select * from hr.test;
ID NAME
---------- --------------------
1 red
2 green