Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Does a datafile know *its* blocksize ?

Re: Does a datafile know *its* blocksize ?

From: Brian Peasland <dba_at_nospam.peasland.net>
Date: Tue, 5 Sep 2006 18:42:57 GMT
Message-ID: <J54uno.CLA@igsrsparc2.er.usgs.gov>


Steve Howard wrote:
> Spendius wrote:

>> Brian Peasland a écrit :
>>> The tablespace's block size does not have any correlation to its extent
>>> allocation algorithm or segment space management.
>> I was talking about the fact that the blocksize is stored in the
>> datafile or not.

>
> I am never sure where Oracle stores stuff. A lot of the time, you can
> see convert the hex in the file to the ascii equivalent, epscially for
> strings. Below is what is *not* a null character in the first two
> blocks (8K block size of the users datafile in my small test 10.2.0.2
> database on XP professional).
>
> C:\SCRIPTS\java>java readBinaryFile
> "C:\oracle\product\10.2.0\oradata\test10g\USE
> RS01.DBF" 1 16384
> BYTE 2 value is 162 in decimal.
> BYTE 7 value is 192 in decimal.
> BYTE 8 value is 255 in decimal.
> BYTE 17 value is 255 in decimal.
> BYTE 18 value is 103 in decimal.
> BYTE 22 value is 32 in decimal.
> BYTE 25 value is 57 in decimal.
> BYTE 26 value is 28 in decimal.
> BYTE 29 value is 125 in decimal.
> BYTE 30 value is 124 in decimal.
> BYTE 31 value is 123 in decimal.
> BYTE 32 value is 122 in decimal.
> BYTE 8193 value is 11 in decimal.
> BYTE 8194 value is 162 in decimal.
> BYTE 8197 value is 1 in decimal.
> BYTE 8200 value is 1 in decimal.
> BYTE 8207 value is 1 in decimal.
> BYTE 8208 value is 4 in decimal.
> BYTE 8209 value is 236 in decimal.
> BYTE 8210 value is 86 in decimal.
> BYTE 8218 value is 1 in decimal.
> BYTE 8219 value is 32 in decimal.
> BYTE 8220 value is 10 in decimal.
> BYTE 8221 value is 171 in decimal.
> BYTE 8222 value is 157 in decimal.
> BYTE 8223 value is 190 in decimal.
> BYTE 8224 value is 50 in decimal.
> BYTE 8225 value is 84 in decimal.
> BYTE 8226 value is 69 in decimal.
> BYTE 8227 value is 83 in decimal.
> BYTE 8228 value is 84 in decimal.
> BYTE 8229 value is 49 in decimal.
> BYTE 8230 value is 48 in decimal.
> BYTE 8231 value is 71 in decimal.
> BYTE 8233 value is 160 in decimal.
> BYTE 8234 value is 2 in decimal.
> BYTE 8237 value is 57 in decimal.
> BYTE 8238 value is 28 in decimal.
> BYTE 8242 value is 32 in decimal.
> BYTE 8245 value is 4 in decimal.
> BYTE 8247 value is 3 in decimal.
> BYTE 8293 value is 41 in decimal.
> BYTE 8294 value is 38 in decimal.
> BYTE 8301 value is 201 in decimal.
> BYTE 8302 value is 97 in decimal.
> BYTE 8303 value is 214 in decimal.
> BYTE 8304 value is 33 in decimal.
> BYTE 8305 value is 110 in decimal.
> BYTE 8306 value is 167 in decimal.
> BYTE 8307 value is 192 in decimal.
> BYTE 8308 value is 35 in decimal.
> BYTE 8309 value is 123 in decimal.
> BYTE 8310 value is 41 in decimal.
> BYTE 8311 value is 8 in decimal.
> BYTE 8331 value is 4 in decimal.
> BYTE 8333 value is 70 in decimal.
> BYTE 8337 value is 127 in decimal.
> BYTE 8338 value is 49 in decimal.
> BYTE 8339 value is 195 in decimal.
> BYTE 8340 value is 35 in decimal.
> BYTE 8341 value is 69 in decimal.
> BYTE 8525 value is 4 in decimal.
> BYTE 8529 value is 5 in decimal.
> BYTE 8531 value is 85 in decimal. --> This is the USERS tablespace
> name to which it belongs
> BYTE 8532 value is 83 in decimal. -->
> BYTE 8533 value is 69 in decimal. -->
> BYTE 8534 value is 82 in decimal. -->
> BYTE 8535 value is 83 in decimal. -->
> BYTE 8561 value is 4 in decimal.
> BYTE 8609 value is 132 in decimal.
> BYTE 8610 value is 97 in decimal.
> BYTE 8611 value is 214 in decimal.
> BYTE 8612 value is 33 in decimal.
> BYTE 8613 value is 1 in decimal.
> BYTE 8677 value is 242 in decimal.
> BYTE 8678 value is 150 in decimal.
> BYTE 8679 value is 9 in decimal.
> BYTE 8685 value is 55 in decimal.
> BYTE 8686 value is 168 in decimal.
> BYTE 8687 value is 200 in decimal.
> BYTE 8688 value is 35 in decimal.
> BYTE 8689 value is 1 in decimal.
> BYTE 8693 value is 8 in decimal.
> BYTE 8697 value is 98 in decimal.
> BYTE 8698 value is 197 in decimal.
> BYTE 8701 value is 16 in decimal.
> BYTE 8705 value is 2 in decimal.
> BYTE 8837 value is 7 in decimal.
> BYTE 8839 value is 7 in decimal.
> BYTE 8841 value is 7 in decimal.
> BYTE 8843 value is 1 in decimal.
> BYTE 8857 value is 2 in decimal.
> BYTE 8860 value is 1 in decimal.
> BYTE 16381 value is 1 in decimal.
> BYTE 16382 value is 11 in decimal.
>
> Oracle stores integers in a proprietary format. It's not a straight
> hex conversion, use the dump(number,16) function for an example. The
> block size may be in there somewhere above, I don't know. Part of it
> is the extent bitmap as well.
>
> What is interesting is that even after I issued a system checkpoint,
> none of the byte values above changed. As a result, I don't even know
> where the current checkpoint number is stored, LOL!
>
> It's nice we don't *have* to know this stuff, but like you, I am always
> curious :)
>
> Regards,
>
> Steve
>

To add to the exercise...... (I think I'm going to kill a cat here!)

First, I'll dump the data file headers:

SQL> alter session set events 'immediate trace name FILE_HDRS level 10';

Session altered.

Next, I'll look at the resulting trace file:

DUMP OF DATA FILES: 8 files in database

DATA FILE #1:
   (name #4) /edcsns18/oradata2/gast/gast/system01.dbf creation size=19200 block size=16384 status=0xe head=4 tail=4 dup=1   tablespace 0, index=1 krfil=1 prev_file=0   unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00   Checkpoint cnt:2167 scn: 0x0000.00922c7b 09/05/2006 00:19:36   Stop scn: 0xffff.ffffffff 09/01/2006 06:47:06   Creation Checkpointed at scn: 0x0000.00000006 01/09/2006 15:40:20   thread:1 rba:(0x1.3.10)
<rest snipped for brevity>

As you can see, when I dump the file header, it showed the block size is 16KB. The first file belongs to tablespace 0, which is the SYSTEM tablespace (no surprise) as can be verified in SYS.TS$ should one be curious. You can even see the checkpoint SCN's.

I'm not sure where all of this is stored, byte-wise, looking at a strict binary dump of the datafile. And I'm not really sure I care exactly *where* it is as I can always dump the file header as seen above and look at it in a more human form.

HTH,
Brian

-- 
===================================================================

Brian Peasland
dba_at_nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown
Received on Tue Sep 05 2006 - 13:42:57 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US