A data block dump shows detailed information of the contents of the block for the given datafile number and the block number. It shows you exactly how the data is stored internally. Depending on whether it is a table or index segment, the data block will list the contents of rows or index keys. The segment header block dump will list the extent map information. The undo header block dump will list the free extent pool in the undo segments. You may need to dump the contents of the data block when investigating block corruptions. In addition, complex recovery situations also warrant block dumps to check the SCN of the block.
The following methods dump the contents of the interested data blocks to the trace file in the UDUMP directory. Data block dumps contain the actual data stored in the blocks.
Note ‚ | If your database instance has the hidden parameter _TRACE_FILES_PUBLIC set to TRUE , please remember that the trace file data can be viewed by anyone with access to your database server machine. It will compromise data security and confidentiality. |
The first line in the following syntax dumps the specified single block, while the second line dumps a range of adjacent blocks.
alter system dump datafile <file#> block <block#>;
alter system dump datafile <file#> block min <min_block#> block max <max_block#>;
The following procedure can be used to dump the segment header block and the data block of a given segment. You need to identify the file# and block# for the segment. The DBA_EXTENTS view can be queried to get this information:
select file_id, block_id, blocks
from dba_extents
where segment_name = TEST;
FILE_ID BLOCK_ID BLOCKS
---------- ---------- ----------
1 29081 8
REM ---- To dump the segment header block
alter system dump datafile 1 block 29081;
REM ---- To dump the data block next to the segment header
alter system dump datafile 1 block 29082
REM ---- To dump both the blocks at the same time
alter system dump datafile 1 block min 29081 block max 29082;
Oradebug is generally not used for block dumps.