下面的示例演示如何恢复已删除的行。当Oracle中的行被删除时,数据实际上并没有被删除。行被简单地标记为已删除,空闲空间计数器和指针也相应地进行了调整。行状态存储在行头中,行头占用每一行的前几个字节。
行头由Row Flag、Lock Byte(ITL entry) and Column Count组成。行头由一个字节大小的 the Row Flag开始,它持有一个位掩码来显示行状态。位掩码解码如下:
因此,适合单个块的列,没有被链接、迁移或集群表的一部分,也没有被删除,将具有以下属性:
SQL> alter system dump datafile 5 block 1551; System altered. Block header dump: 0x0140060f Object id on Block? Y seg/obj: 0x15720 csc: 0x00.111e90 itc: 2 flg: E typ: 1 - DATA brn: 0 bdba: 0x1400608 ver: 0x01 opc: 0 inc: 0 exflg: 0 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x0002.00a.0000039c 0x00c000fd.00c0.13 --U- 1 fsc 0x0000.00111e92 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 bdba: 0x0140060f data_block_dump,data header at 0x7fa17e07f264 =============== tsiz: 0x1f98 hsiz: 0x14 pbl: 0x7fa17e07f264 76543210 flag=-------- ntab=1 nrow=1 frre=-1 fsbo=0x14 fseo=0x1f8d avsp=0x1f79 tosp=0x1f79 0xe:pti[0]nrow=1offs=0 0x12:pri[0]offs=0x1f8d block_row_dump: tab 0, row 0, @0x1f8d tl: 11 fb: --H-FL-- lb: 0x1 cc: 1 col 0: [ 7] 78 78 78 73 74 61 72 end_of_block_dump
BBED> find /c star File: /oradata/epmsn/hsql01.dbf (5) Block: 1551 Offsets: 8184 to 8191 Dba:0x0140060f ------------------------------------------------------------------------ 73746172 0106921e <32 bytes per line> BBED> p *kdbr[0] rowdata[0] ---------- ub1 rowdata[0] @8177 0x2c BBED> d /v dba 5,1551 offset 8177 File: /oradata/epmsn/hsql01.dbf (5) Block: 1551 Offsets: 8177 to 8191 Dba:0x0140060f ------------------------------------------------------- 2c010107 78787873 74617201 06921e l ,...xxxstar.... <16 bytes per line> BBED> d /v dba 5,1551 offset 8177 File: /oradata/epmsn/hsql01.dbf (5) Block: 1551 Offsets: 8177 to 8191 Dba:0x0140060f ------------------------------------------------------- 2c010107 78787873 74617201 06921e l ,...xxxstar.... <16 bytes per line> ************************************************删除数据 SQL> select * from hsql.test4; CONS_NAME ------------------------------ xxxstar SQL> delete from hsql.test4; 1 row deleted. SQL> commit; Commit complete. SQL> select * from hsql.test4; no rows selected ********************************end 删除数据 BBED> d /v dba 5,1551 offset 8177 File: /oradata/epmsn/hsql01.dbf (5) Block: 1551 Offsets: 8177 to 8191 Dba:0x0140060f ------------------------------------------------------- 3c020107 78787873 74617201 06a028 l <...xxxstar...( <16 bytes per line> BBED> modify /x 2c offset 8177 File: /oradata/epmsn/hsql01.dbf (5) Block: 1551 Offsets: 8177 to 8191 Dba:0x0140060f ------------------------------------------------------------------------ 2c020107 78787873 74617201 06a028 <32 bytes per line> BBED> sum dba 5,1551 apply Check value for File 5, Block 1551: current = 0x9ec9, required = 0x9ec9 *********************查询un-delete的数据 SQL> select * from hsql.test4; no rows selected SQL> alter system flush buffer_cache; System altered. SQL> select * from hsql.test4; CONS_NAME ------------------------------ xxxstar SQL>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。