Today I will write a simple article about how to use the combination of Oracle bbed and Oracle Data File block formatsArticle. To better understand something inside the database. A record is deleted
Then, how to directly restore data by directly modifying ORACLE data files. Of course, no matter whether the table is deleted, dropped, or teuncate, there are a lot of restoration operations.
Method. This is only one of the studies. In order to play a role. (For Reprinted data, please indicate the source www.sosdb.com)
The entire process is explained in detail through specific experiments as follows:
1. Create tablespace sosdbcom datafile '/ora/sosdbcom. dbf' size 5 m;
2. Create Table sosdb (sos01 varchar2 (15), sos02 number (4) tablespace sosdbcom;
3. insert into sosdb values ('www .sosdb.com ', 86)
Insert into sosdb select * From sosdb.com;
Insert into sosdb select * From sosdb.com;
Commit;
4. Select * From sosdb;
Sos01 sos02
-------------------------
Www.sosdb.com 86
Www.sosdb.com 86
Www.sosdb.com 86
Www.sosdb.com 86
Now let's delete one. Select the first one.
5. Delete from sosdb where roenum <2;
Commit;
Now look
SQL> select * From sosdb;
Sos01 sos02
-------------------------
Www.sosdb.com 86
Www.sosdb.com 86
Www.sosdb.com 86
SQL>
Okay, the rest of the work is how to modify the block of Oracle datafile
To restore the deleted record.
You need to use bbed here. For the usage of bbed, see:
Http://www.sosdb.com/jdul/dispbbs.asp? Boardid = 1 & id = 237 & page = 1
Write a bbed parameter file par. BBD
Blocksize = 8192
Listfile+a.txt
Mode = Edit
Write an a.txt File
15/ora/sosdbcom. DBF 5251072
Open bbed:
[Oracle @ mail ora] $./bbed parfile = par. BBD
Dump File 14 block 10 count 8192
Let's take a look at this block dump and we will find that the last part is:
00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 2c00020d 77772e 736f7364 622e636f 6d02c157
2c00020d 77772e 736f7364 622e636f 6d02c157 2c00020d 7777772e 736f7364
622e636f 6d02c157 3c02020d 77772e 736f7364 622e636f 6d02c157 01064cd4
The analysis will find that the mark of each row is 2c00, but one is 3c02. In fact, this is the mark of the deleted record. We only
You need to modify the mark, and then modify some of the mark of the data file.
The modification method is as follows:
Bbed> Modify/X 2C file 14 block 10 offset 8168
Bbed> Modify/x 00 file 14 block 10 offset 8169
After modification, the block status is upt. Use the sum command to make it valid.
Bbed> sum file 14 block 10 apply
Restart the Oracle database and query the table sosdb:
SQL> Conn/As sysdba
Connected to an idle instance.
SQL> startup
Oracle instance started.
Total system global area 236000356 bytes
Fixed size 451684 bytes
Variable Size 201326592 bytes
Database buffers 33554432 bytes
Redo buffers 667648 bytes
Database mounted.
Database opened.
SQL> select * From sosdb;
Sos01 sos02
-------------------------
Www.sosdb.com 86
Www.sosdb.com 86
Www.sosdb.com 86
Www.sosdb.com 86
OK. At this point, the deleted record is successfully restored.
Here is just a simple example. In fact, many times we can use this method to do other work, especially recovery.