"Oracle" uses bbed to recover delete data

Source: Internet
Author: User

The data in the table does not actually delete the data after it has been deleted, but instead it hits a delete tag that can be recovered only if it has not been overwritten.

The experimental steps are as follows:

[Email protected]>create table bbed_test (x varchar2 (20));

Table created.

[email protected]>insert into bbed_test values (' BADLY9 ');

1 row created.

[email protected]>insert into bbed_test values (' JP ');

1 row created.

[Email protected]>commit;

Commit complete.

[Email Protected]>select rowid, dbms_rowid.rowid_relative_fno (ROWID) Rel_fno,

2 Dbms_rowid.rowid_block_number (ROWID) Blockno,

3 Dbms_rowid.rowid_row_number (ROWID) rowno

4 from Bbed_test;

ROWID rel_fno Blockno ROWNO

------------------ ---------- ---------- ----------

AAAM0VAABAAAOUCAAA 1 60290 0

Aaam0vaabaaaoucaab 1 60290 1

[Email protected]>alter system flush Buffer_cache;

System altered.

[Email protected]>alter system dump datafile 1 block 60290;

System altered.

[Email Protected]>oradebug setmypid

Statement processed.

[Email Protected]>oradebug tracefile_name

/u01/app/oracle/admin/orcl/udump/orcl_ora_18509.trc

View dump file

Block_row_dump:

tab 0, row 0, @0x1f96

Tl:10 FB:--h-fl-- lb:0x1 cc:1

Col 0: [6] 4c 59 39

tab 0, row 1, @0x1f90

Tl:6 FB:--h-fl-- lb:0x1 cc:1

Col 0: [2] 4a 50

End_of_block_dump

The location of the red Marker records the status of the row's data :

If it is not deleted, it is --H-FL--, Its corresponding value is 0x2c

has been deleted is --hdfl--, its corresponding value is 0x3c

Let's take a look at the following line of data:

[Email protected]>delete bbed_test where x= ' BADLY9 ';

1 row deleted.

[Email protected]>commit;

Commit complete.

[Email Protected]>select * from Bbed_test;

X

--------------------

Jp

[Email protected]> alter system flush Buffer_cache;

System altered.

[Email protected]>alter system dump datafile 1 block 60290;

System altered.

View dump file

Block_row_dump:

tab 0, row 0, @0x1f96

Tl:2 FB:--hdfl-- lb:0x2

tab 0, row 1, @0x1f90

Tl:6 FB:--h-fl-- lb:0x0 cc:1

Col 0: [2] 4a 50

End_of_block_dump

You can see that the data for row 0 is now marked for deletion.

The following uses the bbed tool to restore the data back:

Bbed> Set DBA 1,60290

DBA 0x0040eb82 (4254594 1,60290)

Bbed> f/c BADLY9

File:/u01/app/oracle/oradata/orcl/system01.dbf (1)

block:60290 offsets:8182 to 8191 dba:0x0040eb82

------------------------------------------------------------------------

4241444c 59390206 1e62

<32 bytes per line>

Bbed> P *KDBR

ROWDATA[6]

----------

Ub1 Rowdata[6] @8178 0x3c

Bbed> Set Offset 8178

OFFSET 8178

Bbed> m/x 2c

File:/u01/app/oracle/oradata/orcl/system01.dbf (1)

block:60290 offsets:8178 to 8191 dba:0x0040eb82

------------------------------------------------------------------------

2c020106 4241444c 59390206 1e62

<32 bytes per line>

bbed> sum apply

Check value for File 1, Block 60290:

Current = 0xc7d4, required = 0xc7d4

Now, check out the library.

[Email protected]>alter system flush Buffer_cache;

System altered.

[Email Protected]>select * from Bbed_test;

X

--------------------

BADLY9

Jp

Be able to see that the deleted data has been restored back.

"Oracle" uses bbed to recover delete data

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.