June 12, 2008

first fifty blocks

Yesterday, I started off on a trip to find out what goes inside the data file. I started with first dumping the headers of all data files using:

SQL > ALTER SESSION SET EVENTS 'IMMEDIATE TRACE NAME FILE_HDRS LEVEL 10';

This gives you details from the initial blocks of the data file. Subsequent blocks could be dumped using the command:

SQL > ALTER SYSTEM DUMP DATAFILE 4 BLOCK MIN 2 BLOCK MAX 50;

Once I had the above file ready, I used grep to filter out the information that I was interested in.

grep -i -a -A 2 -B 2 frmt /oracle/admin/my10gdb/udump/tracefilename.trc

This is what I get out of doing this:

buffer tsn: 4 rdba: 0x01000002 (4/2)
scn: 0x0000.00093217 seq: 0x02 flg: 0x04 tail: 0x32171d02
frmt: 0x02 chkval: 0x959c type: 0x1d=KTFB Bitmapped File Space Header
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x04BF2200 to 0x04BF4200
--
buffer tsn: 4 rdba: 0x01000003 (4/3)
scn: 0x0000.00093217 seq: 0x01 flg: 0x04 tail: 0x32171e01
frmt: 0x02 chkval: 0xbee7 type: 0x1e=KTFB Bitmapped File Space Bitmap
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x04BF2200 to 0x04BF4200
.....

--
buffer tsn: 4 rdba: 0x01000009 (4/9)
scn: 0x0000.0006e954 seq: 0x02 flg: 0x04 tail: 0xe9542002
frmt: 0x02 chkval: 0x78dc type: 0x20=FIRST LEVEL BITMAP BLOCK
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x04BF2200 to 0x04BF4200
--
...further down...

buffer tsn: 4 rdba: 0x0100000b (4/11)
scn: 0x0000.0006e954 seq: 0x02 flg: 0x04 tail: 0xe9542302
frmt: 0x02 chkval: 0x1529 type: 0x23=PAGETABLE SEGMENT HEADER
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x04BF2200 to 0x04BF4200
--
buffer tsn: 4 rdba: 0x0100000c (4/12)
scn: 0x0000.0006e954 seq: 0x01 flg: 0x04 tail: 0xe9540601
frmt: 0x02 chkval: 0x17a9 type: 0x06=trans data
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x04BF2200 to 0x04BF4200
--

Now I have my hands full on trying to make head or tail out of this information. One interesting stuff I noticed yesterday. If the data file does not contain any tables, the blocks following the bitmaps are marked as CORRUPT!

No comments: