Wednesday, November 19, 2008

Oracle: Data Block

Data Blocks: Smallest logical component of oracle database.It consists of number of bytes of disk space in OS. Usually in units of 2kb,4kb,8kb(Default),16kb or 32kb.

DB_BLOCK_SIZE gives your current block size.

Remember, Oracle will read the disk in terms of blocks. If you a have name of 4kb stored in a 32kb block, oracle will read the entire 32kb to retrieve your name. Also, OS also has disk block size and reads data in terms of disk block, Typically your oracle block size should be a multiple of disk block size.

System Tablespace is always created with standard block size. In addition to standard you can create 4 non standard block size for your tablespace.Data block contains row data portion (data stored in table or index) , free space prortion (space left for new data),overhad and header portion (for maintenance).

Extents: Two or more contiguous (touching each other) data blocks. It is a unit of space allocation
Segements: Set of extents to form a logical structure like table or index
Tablspace: Set of one or more data files containing related segments

In order to see data contained in a block, you need to dump it in OS

Select OWNER,SEGMENT_NAME,segment_type,tablespace_name,
header_file,header_block from dba_segments
where segment_name = 'CASES'

Alter System dump datafile header_file BLOCK header_block

Alter system dump datafile 15 block 1339

Go to UDUMP directory, the latest *.trc file will contain the binary dump of the block

No comments:

Post a Comment