The Java program I wrote to extract the data below can be found here :- http://blog.contractoracle.com/2013/02/java-program-to-extract-records-from.html
The basics :-
- The controlfile is composed of blocks that are 2X database block size.
- Each block has a header of 18 bytes.
- Each block has a tail of 4 bytes.
- Each block is duplexed within the datafile for redundancy. E.g Block 31 is duplexed to Block 32.
The database name is stored in block 2 starting at byte 32.
Number of Blocks :- 595
Block :- 2
Tablespace Name :- WIN64
File information starts in block 31 and is contained in records of 524 bytes.
The first 12 bytes is record header information, and the last 512 bytes is the file name. Byte 3 indicates the file type (3=LOG, 4=DATA, 7=TEMPFILE) and byte 5 appears to be file ID (unique for each file type)
Following is an example of extracting file details from a Control File :-
Number of Blocks :- 595
Block :- 31
Record :- 1
Byte 1 :- 00
Byte 2 :- 00
File Type 3-LOG, 4-DATA, 7-TEMP :- 03
Byte 4 :- 00
File ID :- 3
Byte 6 :- 00
Byte 7 :- 00
Byte 8 :- 00
Byte 9 :- 00
Byte 10 :- 00
Byte 11 :- 00
Byte 12 :- 00
File Name :- D:\ORACLE\WIN64\ONLINELOG\O1_MF_3_8L5T3995_.LOG
Record :- 2
Byte 1 :- 00
Byte 2 :- 00
File Type 3-LOG, 4-DATA, 7-TEMP :- 03
Byte 4 :- 00
File ID :- 2
Byte 6 :- 00
Byte 7 :- 00
Byte 8 :- 00
Byte 9 :- 00
Byte 10 :- 00
Byte 11 :- 00
Byte 12 :- 00
File Name :- D:\ORACLE\WIN64\ONLINELOG\O1_MF_2_8L5T38G3_.LOG
Record :- 3
Byte 1 :- 00
Byte 2 :- 00
File Type 3-LOG, 4-DATA, 7-TEMP :- 03
Byte 4 :- 00
File ID :- 1
Byte 6 :- 00
Byte 7 :- 00
Byte 8 :- 00
Byte 9 :- 00
Byte 10 :- 00
Byte 11 :- 00
Byte 12 :- 00
File Name :- D:\ORACLE\WIN64\ONLINELOG\O1_MF_1_8L5T37VY_.LOG
Record :- 4
Byte 1 :- 00
Byte 2 :- 00
File Type 3-LOG, 4-DATA, 7-TEMP :- 04
Byte 4 :- 00
File ID :- 4
Byte 6 :- 00
Byte 7 :- 00
Byte 8 :- 00
Byte 9 :- 00
Byte 10 :- 00
Byte 11 :- 00
Byte 12 :- 00
File Name :- D:\ORACLE\WIN64\DATAFILE\O1_MF_USERS_8L5T0ZC4_.DBF
Record :- 5
Byte 1 :- 00
Byte 2 :- 00
File Type 3-LOG, 4-DATA, 7-TEMP :- 04
Byte 4 :- 00
File ID :- 3
Byte 6 :- 00
Byte 7 :- 00
Byte 8 :- 00
Byte 9 :- 00
Byte 10 :- 00
Byte 11 :- 00
Byte 12 :- 00
File Name :- D:\ORACLE\WIN64\DATAFILE\O1_MF_UNDOTBS1_8L5T0ZBF_.DBF
Record :- 6
Byte 1 :- 00
Byte 2 :- 00
File Type 3-LOG, 4-DATA, 7-TEMP :- 04
Byte 4 :- 00
File ID :- 2
Byte 6 :- 00
Byte 7 :- 00
Byte 8 :- 00
Byte 9 :- 00
Byte 10 :- 00
Byte 11 :- 00
Byte 12 :- 00
File Name :- D:\ORACLE\WIN64\DATAFILE\O1_MF_SYSAUX_8L5T0ZB4_.DBF
Record :- 7
Byte 1 :- 00
Byte 2 :- 00
File Type 3-LOG, 4-DATA, 7-TEMP :- 04
Byte 4 :- 00
File ID :- 1
Byte 6 :- 00
Byte 7 :- 00
Byte 8 :- 00
Byte 9 :- 00
Byte 10 :- 00
Byte 11 :- 00
Byte 12 :- 00
File Name :- D:\ORACLE\WIN64\DATAFILE\O1_MF_SYSTEM_8L5T0Z83_.DBF
Record :- 8
Byte 1 :- 00
Byte 2 :- 00
File Type 3-LOG, 4-DATA, 7-TEMP :- 07
Byte 4 :- 00
File ID :- 1
Byte 6 :- 00
Byte 7 :- 00
Byte 8 :- 00
Byte 9 :- 00
Byte 10 :- 00
Byte 11 :- 00
Byte 12 :- 00
File Name :- D:\ORACLE\WIN64\DATAFILE\O1_MF_TEMP_8L5T3MYY_.TMP
Tablespace information starts at block 179 and is contained in 68 byte records. The first 8 bytes of the record are header information, with byte 3 being TABLESPACE#.
Following is an example of tablespace information extract from a Control File.
Block :- 179
Record :- 1
Byte 1 :- 00
Byte 2 :- 00
Tablespace ID :- 00
Byte 4 :- 00
Byte 5 :- 00
Byte 6 :- 00
Byte 7 :- 06
Byte 8 :- 00
Tablespace Name :- SYSTEM
Record :- 2
Byte 1 :- 00
Byte 2 :- 00
Tablespace ID :- 01
Byte 4 :- 00
Byte 5 :- 00
Byte 6 :- 00
Byte 7 :- 06
Byte 8 :- 00
Tablespace Name :- SYSAUX
Record :- 3
Byte 1 :- 00
Byte 2 :- 00
Tablespace ID :- 02
Byte 4 :- 00
Byte 5 :- 00
Byte 6 :- 00
Byte 7 :- 08
Byte 8 :- 00
Tablespace Name :- UNDOTBS1
Record :- 4
Byte 1 :- 00
Byte 2 :- 00
Tablespace ID :- 04
Byte 4 :- 00
Byte 5 :- 00
Byte 6 :- 00
Byte 7 :- 05
Byte 8 :- 00
Tablespace Name :- USERS
Record :- 5
Byte 1 :- 00
Byte 2 :- 00
Tablespace ID :- 03
Byte 4 :- 00
Byte 5 :- 00
Byte 6 :- 00
Byte 7 :- 04
Byte 8 :- 00
Tablespace Name :- TEMP
No comments:
Post a Comment