下面的示例演示如何恢復(fù)已刪除的行。當(dāng)Oracle中的行被刪除時,數(shù)據(jù)實際上并沒有被刪除。行被簡單地標(biāo)記為已刪除,空閑空間計數(shù)器和指針也相應(yīng)地進行了調(diào)整。行狀態(tài)存儲在行頭中,行頭占用每一行的前幾個字節(jié)。
為相城等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務(wù),及相城網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為成都網(wǎng)站制作、網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)、相城網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠(yuǎn)!
行頭由Row Flag、Lock Byte(ITL entry) and Column Count組成。行頭由一個字節(jié)大小的 the Row Flag開始,它持有一個位掩碼來顯示行狀態(tài)。位掩碼解碼如下:
因此,適合單個塊的列,沒有被鏈接、遷移或集群表的一部分,也沒有被刪除,將具有以下屬性:
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> ************************************************刪除數(shù)據(jù) 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 刪除數(shù)據(jù) 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的數(shù)據(jù) 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>