转自网络:
1、dump数据文件头
就是datafile 的第1,第2个block,我们直接通过alter system dump datafile n block min 1 max 2;是得不到任何信息的,请看测试:
SQL> alter system dump datafile 1 block min 1 block max 2;
系统已更改。
部分的DUMP文件内容
Start dump data blocks tsn: 0 file#: 1 minblk 1 maxblk 2
Block 1 (file header) not dumped: use dump file header command ----这里已经说明了,file header 没有dump出来
buffer tsn: 0 rdba: 0x00400002 (1/2)
scn: 0x0000.001d3fde seq: 0x01 flg: 0x04 tail: 0x3fde1d01
frmt: 0x02 chkval: 0x8ebb type: 0x1d=KTFB Bitmapped File Space Header
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x09667800 to 0x09669800
9667800 0000A21D 00400002 001D3FDE 04010000 [......@..?......]
9667810 00008EBB 00000001 00000008 0000F500 [................]
9667820 00000009 00000500 003FFFFE 00000007 [..........?.....]
9667830 0000F500 00001DB8 00000087 001D3FDC [.............?..]
9667840 00000000 00000000 00000000 00000000 [................]
9667850 0000EDC9 00000008 00000000 00000000 [................]
9667860 00000000 00000000 00000000 00000000 [................]
Repeat 504 times
96697F0 00000000 00000000 00000000 3FDE1D01 [...............?]
File Space Header Block:
Header Control:
RelFno: 1, Unit: 8, Size: 62720, Flag: 9
AutoExtend: YES, Increment: 1280, MaxSize: 4194302
Initial Area: 7, Tail: 62720, First: 7608, Free: 135
Deallocation scn: 1916892.0
Header Opcode:
Save: No Pending Op
End dump data blocks tsn: 0 file#: 1 minblk 2 maxblk 2
上面的dump文件没有任何有价值的信息,查看DSI文档403 File Dump Analysis 一节可以知道,如果要得到 file header的dump文件,必须通过ORADEBUGE或者以下命令
alter system set events 'immediate trace name file_hdrs level 1'; -----控制文件中关于datafile 的记录条目
alter system set events 'immediate trace name file_hdrs level 2'; -----包含level1 以及generic header
alter system set events 'immediate trace name file_hdrs level 3; ---包含level2以及header information in the datafile
现在以 datafile 1为研究对象
SQL>
alter system set events 'immediate trace name file_hdrs level 3';
System altered
datafile 1的 dump文件,注意虚线(-----)的部分是我的注释
DATA FILE #1:
----这一片内容存在于控制文件中,我们通过level 1的转储就只能得到该信息
(name #10) C:/ORACLE/PRODUCT/10.2.0/ORADATA/ROBINSON/DATAFILE/O1_MF_SYSTEM_5H28M6WT_.DBF
creation size=0 block size=8192 status=0xe head=10 tail=10 dup=1
tablespace 0, index=1 krfil=1 prev_file=0 ---prev_file表示相同表空间的前一个数据文件号
unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
Checkpoint cnt:421 scn: 0x0000.001d46c8 12/25/2009 10:06:40 ---这条信息也会记录在datafile header中
Stop scn: 0xffff.ffffffff 12/24/2009 18:01:27 ----如果是0xffff.ffffffff表示该文件正被打开,如果文件未打开表示最后关闭的SCN
Creation Checkpointed at scn: 0x0000.0000000b 04/17/2007 03:34:41
thread:0 rba:(0x0.0.0)
enabled threads: 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000
Offline scn: 0x0000.0007f64a prev_range: 0
Online Checkpointed at scn: 0x0000.0007f64b 11/04/2009 11:42:25
--表示此数据文件online还是offline的,用于快速跳过archive log恢复
thread:1 rba:(0x1.2.0) ---不明白
enabled threads: 01000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000
Hot Backup end marker scn: 0x0000.00000000
aux_file is NOT DEFINED
V10 STYLE FILE HEADER: ---------这一片是generic file header,level必须>=2才有此信息
Compatibility Vsn = 169870080=0xa200300 ---------control,redo,data,temp文件都有相同的generic file header
Db ID=162442526=0x9aead1e, Db Name='ROBINSON' ---这些内容存在于datafile 第一个block.
Activation ID=0=0x0 -----这个不知道,知道的哥们告诉俺一声,给俺留个言吧
Control Seq=5455=0x154f, File size=62720=0xf500
---control seq表示控制文件序列号,更新控制文件的时候也会更新seq,如果控制文件中的control seq小于数据文件中的control sel,表示控制文件来自于备份。File size 不是表示整个文件的大小,而是表示当前保存在cache
layer中的大小
File Number=1, Blksiz=8192, File Type=3 DATA ---TYPE=3表示普通的数据文件(包括undo,没有temp,temp的type=6)
-------file number是记录在file$表中的,如果数据文件被删除,那么file number可以重用
Tablespace #0 - SYSTEM rel_fn:1 ----这一片信息是从datafile header block 2中得到的,转储level必须为3才能得到此信息
---tablespace#0表示表空间序号可以查询v$tablespace.ts#验证,rel_fn:1表示relative file number可以通过v$dba_data_files.relativ_fno查到
Creation at scn: 0x0000.0000000b 04/17/2007 03:34:41
---这里表示这个数据文件建立的时间,因为我是通过DBCA创建数据库的,DBCA是根据模板克隆的,所以这里的建立时间为2007年,
事实上我创建这个数据库是在今年(2009年)
Backup taken at scn: 0x0000.00000000 01/01/1988 00:00:00 thread:0
---RMAN是不会更新这个记录的,只有在SQL>中运行begin backup才会更新该信息
reset logs count:0x29d85021 scn: 0x0000.0007f64b reset logs terminal rcv data:0x0 scn: 0x0000.00000000
prev reset logs count:0x24f60fb2 scn: 0x0000.00000001 prev reset logs terminal rcv data:0x0 scn: 0x0000.00000000
recovered at 12/24/2009 09:59:59
status:0x2004 root dba:0x00400179 chkpt cnt: 421 ctl cnt:420
---只有system文件才有root dba,用来定位bootstrap$,ctl cnt 是控制文件的一份拷贝,用于鉴别控制文件是否来自于备份
begin-hot-backup file size: 0---当backup scn被更新,它才就更新
Checkpointed at scn: 0x0000.001d46c8 12/25/2009 10:06:40---每个检查点都会更新此信息,除了在热备份的时候
thread:1 rba:(0x4d.5be4.10)
enabled threads: 01000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000
Backup Checkpointed at scn: 0x0000.00000000
thread:0 rba:(0x0.0.0)
enabled threads: 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000
External cache id: 0x0 0x0 0x0 0x0 ----这个也不是很明白,懂的哥们告诉俺一声
Absolute fuzzy scn: 0x0000.00000000 ---表示该文件是热备份
Recovery fuzzy scn: 0x0000.00000000 11/04/2009 14:40:11
Terminal Recovery Stamp 01/01/1988 00:00:00
Platform Information: Creation Platform ID: 7 ----这个也不知道,平台信息在哪里能查到?知道的哥们告诉我偶一声
Current Platform ID: 7 Last Platform ID: 7 ---不知道.....
2、dump 数据文件第三块
我们知道前两块是datafile haader 文件,第三到第八块是bitmap block ,用于管理每个extent。下面执行:
SQL>
alter system dump datafile 4 block 3;
系统已更改。
*** 2012-10-16 15:20:19.171
Start dump data blocks tsn: 4 file#: 4 minblk 3 maxblk 3
buffer tsn: 4 rdba: 0x01000003 (4/3)
scn: 0x0000.00aebc43 seq: 0x01 flg: 0x04 tail: 0xbc431e01
frmt: 0x02 chkval: 0x956a type: 0x1e=KTFB Bitmapped File Space Bitmap
File Space Bitmap Block:
BitMap Control:
RelFno: 4, BeginBlock: 9, Flag: 0, First: 71, Free: 63221
——71*4 个已经使用的extents ! !
FFFFFFFFFFFFFFFF 7F00FFFFFF3FFFFF 191AFFFFFFFFFFFF FFFFFFFFFFFFFFFF
FFFFFFFF00000000 0000000000000000 0000000000000000 0000000000000000
——这一部分16进制的数,应该转成2进制的,每一位的一个1代表一个extent已经使用,0代表未使用。
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
End dump data blocks tsn: 4 file#: 4 minblk 3 maxblk 3
闲着没事数了一下,上面大概有15808个0 , 应该是每个0代表的是一个十六进制的0,也就是4位,4个extents。
3、dump第九块 第十块
在这里先介绍一下数据文件除了前8块以外的结构,包括1级位图管理块, 二级位图管理块;其中二级位图块里记录一级位图块地址,每个一级位图块管理16个(10g中貌似是10个唉。。),实际上每个一级位图块管理的不一定是16个块,有可能是32个或者更多。。
我们dump一个一级位图块:
SQL>
alter system dump datafile 4 block 9;
系统已更改。
*** 2012-10-16 17:03:00.546
Start dump data blocks tsn: 4 file#: 4 minblk 9 maxblk 9
buffer tsn: 4 rdba: 0x01000009 (4/9)
scn: 0x0000.0004d22f seq: 0x02 flg: 0x04 tail: 0xd22f2002
frmt: 0x02 chkval: 0x79e9 type: 0x20=FIRST LEVEL BITMAP BLOCK
Dump of First Level Bitmap Block
--------------------------------
nbits : 4 nranges: 1 parent dba: 0x0100000a poffset: 0
unformatted: 0 total: 8 first useful block: 3
owning instance : 1
instance ownership changed at 03/10/2004 17:05:34
Last successful Search 03/10/2004 17:05:34
Freeness Status: nf1 0 nf2 0 nf3 0 nf4 5
Extent Map Block Offset: 4294967295
First free datablock : 3
Bitmap block lock opcode 0
Locker xid: : 0x0000.000.00000000
Inc #: 0 Objd: 49047
HWM Flag: HWM Set
Highwater:: 0x01000011 ext#: 0 blk#: 8 ext size: 8
#blocks in seg. hdr's freelists: 0
#blocks below: 5
mapblk 0x00000000 offset: 0
--------------------------------------------------------
DBA Ranges :
--------------------------------------------------------
0x01000009 Length: 8 Offset: 0
0:Metadata 1:Metadata 2:Metadata 3:75-100% free ——描述了9号块管理的8个块的状态。
4:75-100% free 5:75-100% free 6:75-100% free 7:75-100% free
--------------------------------------------------------
End dump data blocks tsn: 4 file#: 4 minblk 9 maxblk 9
可以看到:位图块9管理的8个数据块中3个位图块(不知道是几级的位图块), 剩下5个都是75-100% free 类型的。但是没有 full(满) 和 unformatted(未使用) 类型的。可以想象,这8个块以外的数据块也是这么通过一级位图管理块来管理的,多个位图并行管理明显增加了并行处理的能力。
下面dump出一个二级管理位图块:
*** 2012-10-16 16:57:56.359
Start dump data blocks tsn: 4 file#: 4 minblk 10 maxblk 10
buffer tsn: 4 rdba: 0x0100000a (4/10)
scn: 0x0000.0004d200 seq: 0x01 flg: 0x04 tail: 0xd2002101
frmt: 0x02 chkval: 0x39bf type: 0x21=SECOND LEVEL BITMAP BLOCK
Dump of Second Level Bitmap Block
number: 1 nfree: 1 ffree: 0 pdba: 0x0100000b
Inc #: 0 Objd: 49047
opcode:0
xid:
L1 Ranges : ——如此看来,这个二级管理块只管理了一个一级管理块,其地址是: 0x01000009 ,也就是9号块。
--------------------------------------------------------
0x01000009 Free: 5 Inst: 1
--------------------------------------------------------
End dump data blocks tsn: 4 file#: 4 minblk 10 maxblk 10
更多参照:http://www.itpub.net/thread-734505-1-1.html
4、ORACLE的一个数据文件的最大值
我们知道ORACLE的最小的物理单位是BLOCK,数据文件的组成的最终形式也是block,那么数据文件的大小限制就应该是block数量的限制,那么究竟block的数量有何限制,这里就要提到一个ORACLE内部术语DBA(此dba非数据库管理员,而是data block address)
Extent 0 : L1 dba: 0x01800009 Data dba: 0x0180000d
Extent 1 : L1 dba: 0x01800089 Data dba: 0x0180008b
Extent 2 : L1 dba: 0x01800109 Data dba: 0x0180010b
Extent 3 : L1 dba: 0x01800189 Data dba: 0x0180018b
Extent 4 : L1 dba: 0x01800209 Data dba: 0x0180020b
Extent 5 : L1 dba: 0x01800289 Data dba: 0x0180028b
dba是以16进制表示的(因为有0X),注意看一共用了8位的16进制,换算成二进制就是32bit,而其中DBA又用10位来记录file_id,22bit来记录block_id,那么在一个数据文件中最多能够记录2^22个block,如果一个block_size=8k,那么这个数据文件的最大值就是8K*2^22,也就是32G,所以数据文件的最大值应该取决于块大小,而oracle块最大值是32K,也就是32G*4=128G。
SQL> select power(2,22)*8/1024/1024 from dual;
POWER(2,22)*8/1024/1024
-----------------------
32
我们也可以根据本地管理的表空间算出来,数据文件的前8个块中,后6个是用来标记extents的位置的,而由于extents的大小时不确定的,oracle采用了一个通用的64kb大小为位图标记单位,也就是说,在位图块中的每一位都代表了64KB的数据。通过前面的dump出来的bitmap block来看,一个bitmap block大概有65536个extents标记位(注意这里的标记位是16进制的那个标记位,比如一个F(4个1)代表64K,)
所以一个bitmap block 大概表示数据量:65536*64KB;
一共是6个bitmap block 所以最后得出一个数据文件大小:65536*64*6 / 1024/1024 = 24GB
数量级是正确的,这种方法开来只能估算。不会有准确的值。