下面的示例演示如何恢复已删除的行。当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>