oracle block map

Script for oracle block map

Sometimes, in order to see fragmented tables in Oracle database, you need to check the block map in datafiles.

Here, I’m sharing with you a script for checking that 🙂

col segment_name format a30
col owner format a30
col segment_type format a30
col partition_name format a45
col segment_type format a30
select  file_id,
        block_id,
        block_id + blocks - 1   end_block,
        blocks,
        owner,
        segment_name,
        partition_name,
        segment_type
from dba_extents
where
        tablespace_name = 'SYSAUX'
union all
select  file_id,
        block_id,
        block_id + blocks - 1   end_block,
        blocks,
        'free'                  owner,
        'free'                  segment_name,
        null                    partition_name,
        null                    segment_type
from dba_free_space 
where tablespace_name = 'SYSAUX'
order by 1,2;

SQL Certification passed !

Title1Z0-007 Introduction to Oracle9i: SQL
Started8/28/2008 8:42:24 AM (GMT+0:00)
Ended8/28/2008 9:42:31 AM (GMT+0:00)
Passing Score70%
Your ScorePass – 78.85% (41 earned out of 52 possible)
CommentsCongratulations! Ready for what’s next? Oracle University can get you to your next target proficiency level with additional Oracle classes and certification offerings. Visit Oracle University at http://www.oracle.com/education.