很多时候我们在进行进一步研究时需要转储(dump)Oracle的数据块以研究其内容Oracle提供了很好的方式我们通过以下例子简单说明一下:
[oracle@jumper udump]$ sqlplus / as sysdba
SQL*Plus: Release Production on Tue Aug ::
Copyright (c) Oracle CorporationAll rights reserved
Connected to:
Oraclei Enterprise Edition Release Production
With the Partitioning OLAP and Oracle Data Mining options
JServer Release Production
SQL> select rowiddeptnodnameloc from scottdept;
ROWIDDEPTNO DNAMELOC
AAADZAABAAAGKAAA ACCOUNTING NEW YORK
AAADZAABAAAGKAAB RESEARCH DALLAS
AAADZAABAAAGKAAC SALESCHICAGO
AAADZAABAAAGKAAD OPERATIONS BOSTON
SQL> select file_idblock_idblocks from dba_extents where segment_name=DEPT;
FILE_ID BLOCK_ID BLOCKS
SQL> alter system dump datafile block min block max ;
System altered
SQL> !
[oracle@jumper udump]$ ls l
total
rwr oracle dba Aug : hsjf_ora_trc
[oracle@jumper udump]$ more hsjf_ora_trc
/opt/oracle/admin/hsjf/udump/hsjf_ora_trc
Oraclei Enterprise Edition Release Production
With the Partitioning OLAP and Oracle Data Mining options
JServer Release Production
ORACLE_HOME = /opt/oracle/product/
System name:Linux
Node name:cn
Release:
Version:# Wed Sep :: EDT
Machine:i
Instance name: hsjf
Redo thread mounted by this instance:
Oracle process number:
Unix process pid: image: oraccn (TNS VV)
*** ::
*** SESSION ID:() ::
Start dump data blocks tsn: file#: minblk maxblk
buffer tsn: rdba: xb (/)
scn: xcd seq: x flg: x tail: xcd
frmt: x chkval: xe type: x=DATA SEGMENT HEADER UNLIMITED
Extent Control Header
Extent Header:: spare: spare: #extents: #blocks:
last mapx#maps: offset:
Highwater::xbbext#: blk#: ext size:
#blocks in seg hdrs freelists:
#blocks below:
mapblkxoffset:
Unlocked
Map Header:: nextx#extents: obj#: flag: x
Extent Map
xbalength:
nfl = nfb = typ = nxf = ccnt =
SEG LST:: flg: USED lhd: xba ltl: xba
buffer tsn: rdba: xba (/)
scn: xb seq: x flg: x tail: xb
frmt: x chkval: xae type: x=trans data
Block header dump:xba
Object id on Block? Y
seg/obj: xbcsc: xaitc: flg: Otyp: DATA
fsl: fnx: x ver: x
Itl XidUba FlagLckScn/Fsc
x xafxbCscn xce
x xxfsc x
data_block_dumpdata header at xadbc
===============
tsiz: xfa
hsiz: xa
pbl: xadbc
bdba: xba
flag=
ntab=
nrow=
frre=
fsbo=xa
fseo=xf
avsp=xfa
tosp=xfa
xe:pti[]nrow=offs=
x:pri[] offs=xf
x:pri[] offs=xf
x:pri[] offs=xfc
x:pri[] offs=xf
block_row_dump:
tab row @xf
tl: fb: HFL lb: xcc:
col: [ ]c b
col: [] f e e
col: [ ]e f b
tab row @xf
tl: fb: HFL lb: xcc:
col: [ ]c
col: [ ]
col: [ ] c c
tab row @xfc
tl: fb: HFL lb: xcc:
col: [ ]c f
col: [ ] c
col: [ ] f
tab row @xf
tl: fb: HFL lb: xcc:
col: [ ]c
col: []f f e
col: [ ] f f e
end_of_block_dump
End dump data blocks tsn: file#: minblk maxblk
很多人经常提出的一个问题是rdba是如何转换的?
rdba: xba (/)
我们通过这个例子介绍一下
rdba从Oracle>Oracle>Oracle发生了三次改变:
在Oracle中rdba由位进制数表示也就是说数据块最多只能有^=个数据文件(去掉全和全 实际上最多只能代表个文件)
在Oracle中rdba中的文件号增加为位为了向后兼容从Block号的高位拿出位作为文件号的高位这样从>的Rowid无需发生变化
在Oracle中文件号仍然用位表示只是不再需要置换为了向后兼容同时引入了相对文件号(rfile#)所以从Oracle到OracleRowid仍然无需发生变化
举例说明如下:
在Oracle中:
比如: file block
位block号==
vvvvvvvvvvvvvvvvvvvvvvvvvv
^^^^^^
位文件号==
在Oracle中:
比如:File block
F CC D E C
\_____/\___/\_______________________/
| | |
| |Block = xDEC =
\_____________
| V V
= xFF = 注意这里高位和低位要置换才能得出正确的file#
在Oracle中:
比如:File block
F CC D E C
\_____/\___/\_______________________/
| | |
| |Block = xDEC =
\_____________
| V V
= F = 这就是相对文件号
对于我们测试中的例子:
rdba: xba (/)
也就是:
前位为rfile#: =
后位为Block#: =