Chinaunix首页 | 论坛 | 博客
  • 博客访问: 76083
  • 博文数量: 54
  • 博客积分: 1400
  • 博客等级: 上尉
  • 技术积分: 600
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-16 16:44
文章分类

全部博文(54)

文章存档

2011年(2)

2009年(28)

2008年(24)

我的朋友

分类: Oracle

2008-09-22 15:21:42

It is possible to peek into the datafiles and see what data they contain. In order to demonstrate that, I create a table (dump_table), fill some data in it and dump it into a file for further inspecting.
The statement to dump one or more is
 
  block min  block max 
 
Here's the table that's going to be filled: 
 dump_table (
  a varchar2(4000),
  b varchar2(4000),
  c varchar2(4000),
  d varchar2(4000));
insert into dump_table values(
  'aaaaaaaaaa','bbbbbbbbbb','cccccccccc','dddddddddd');

insert into dump_table values(
  'AAAAAAAAAA','BBBBBBBBBB','CCCCCCCCCC','DDDDDDDDDD');

commit;
 
 

Dumping the Segment's Header Block

 

 

Each table (actually each segment) has a .
First, the file and the block number must be determined before the block can be dumped
 
SQL> select header_file, header_block from  where segment_name = 'DUMP_TABLE';

HEADER_FILE HEADER_BLOCK
----------- ------------
          3       108639
 
 3 block 108639;
 

Location of dumpfile

 

 

This command dumps the block in a more or less readable form. Where is it dumped? The directory in which it is dumped is found like this:

 

 

select value from  where name = 'user_dump_dest';
 
The name of the dumped file is then determined like so: 
 
select spid
from  s,  p
where p.addr = s.paddr
and s.audsid = ('userenv','sessionid')
 
This returns a number. Append this number to ORA and append a suffix .trc
See for a complete script.
Here's the interesting part of the dump file:
 
 
Start dump data blocks tsn: 3 file#: 3 minblk 49 maxblk 49
buffer tsn: 3 rdba: 0x00c00031 (3/49)
scn: 0x0000.0005c24e seq: 0x01 flg: 0x04 tail: 0xc24e1001
frmt: 0x02 chkval: 0x49ed type: 0x10=DATA SEGMENT HEADER - UNLIMITED
  Extent Control Header
  -----------------------------------------------------------------
  Extent Header:: spare1: 0      spare2: 0      #extents: 1      #blocks: 15    
                  last map  0x00000000  #maps: 0      offset: 2080  
      Highwater::  0x00c00033  ext#: 0      blk#: 1      ext size: 15    
  #blocks in seg. hdr's freelists: 1     
  #blocks below: 1     
  mapblk  0x00000000  offset: 0     
                   Unlocked
     Map Header:: next  0x00000000  #extents: 1    obj#: 5927   flag: 0x40000000
  Extent Map
  -----------------------------------------------------------------
   0x00c00032  length: 15    
  
  nfl = 1, nfb = 1 typ = 1 nxf = 0 ccnt = 1
  SEG LST:: flg: USED   lhd: 0x00c00032 ltl: 0x00c00032 
End dump data blocks tsn: 3 file#: 3 minblk 49 maxblk 49
 
 
The number after obj# (that is 5927) is found in : 
 
select name from  where obj# = 5927;
returns DUMP_TABLE. 
 
 
阅读(409) | 评论(0) | 转发(0) |
0

上一篇:查看dump文件

下一篇:c

给主人留下些什么吧!~~