Search notes:

Oracle: Segment header

Dump a segment header

The file and block number of a segment's header can be queried from dba_segments.
With these two numbers, it's possible to dump the information of a segment header into a trace file with alter system dump datafile…:
create table tq84_dump_segment_header_test (
   num  number,
   txt  varchar2(1000)
);

begin

   for i in 1 .. 20 loop
       insert into tq84_dump_segment_header_test values(i, rpad('*', 1000, '*'));
   end loop;

end;
/

commit;

declare

   file_id   number;
   block_id  number;
   dump_file varchar2(1000);

begin

   select header_file, header_block
   into   file_id    , block_id
   from   dba_segments
   where  segment_name = 'TQ84_DUMP_SEGMENT_HEADER_TEST' and
          owner        =  user;

   execute immediate 'alter system dump datafile ' || file_id || ' block ' || block_id;


   select value into   dump_file
   from   v$diag_info
   where  name = 'Default Trace File';

   dbms_output.put_line('  dumped block to: ' ||  dump_file);

end;
/

drop table tq84_dump_segment_header_test;
Github repository Oracle-patterns, path: /logical-structures/segment/header/dump/go.sql
See also dbms_space_admin.segment_dump.

See also

Segments

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758204982, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/architecture/database/logical-structures/segment/header/index(89): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78