ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ITL中xid 和 uba的验证!

ITL中xid 和 uba的验证!

原创 Linux操作系统 作者:warehouse 时间:2007-10-21 00:00:00 0 删除 编辑

ITL中xid 和 uba代表了什么意思?

需要了解block的internal格式!下面通过一个试验做了一些验证!


SQL> truncate table t;

表被截断。

SQL> desc t
名称 是否为空? 类型
----------------------------------------- -------- --------------------------

ID NUMBER(38)
NAME VARCHAR2(10)

SQL> insert into t values(1,'a');

已创建 1 行。

SQL> select id ,name , rowid from t;

ID NAME ROWID
---------- ---------- ------------------
1 a AAADhJAAEAAAAAUAAA

SQL> select dbms_rowid.rowid_block_number(rowid) from t;

DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)
------------------------------------
20

SQL> alter system dump datafile 4 block 20;

系统已更改。
dump信息如下:
--=================================================================================
Start dump data blocks tsn: 8 file#: 4 minblk 20 maxblk 20
buffer tsn: 8 rdba: 0x01000014 (4/20)
scn: 0x0000.0027fd5b seq: 0x03 flg: 0x00 tail: 0xfd5b0603
frmt: 0x02 chkval: 0x0000 type: 0x06=trans data
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x081D2200 to 0x081D4200
.............................
Block header dump: 0x01000014
Object id on Block? Y
seg/obj: 0x3849 csc: 0x00.27fd5b itc: 2 flg: E typ: 1 - DATA
brn: 0 bdba: 0x1000011 ver: 0x01 opc: 0
inc: 0 exflg: 0

Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000c.011.000000e6 0x00800554.00d6.28 ---- 1 fsc 0x0000.00000000
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000

data_block_dump,data header at 0x81d2264
===============
tsiz: 0x1f98
hsiz: 0x14
pbl: 0x081d2264
bdba: 0x01000014
76543210
flag=--------
ntab=1
nrow=1
frre=-1
fsbo=0x14
fseo=0x1f90
avsp=0x1f7b
tosp=0x1f7b
0xe:pti[0] nrow=1 offs=0
0x12:pri[0] offs=0x1f90
block_row_dump:
tab 0, row 0, @0x1f90
tl: 8 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [ 2] c1 02
col 1: [ 1] 61
end_of_block_dump
End dump data blocks tsn: 8 file#: 4 minblk 20 maxblk 20

--=================================================================================
data block的dump信息中ITL中的xid:0x000c.011.000000e6是由undo信息组成的:xidusn.xidslot.xidsqn
验证如下:
SQL> select to_number('000c','xxxxx') from dual;

TO_NUMBER('000C','XXXXX')
-------------------------
12

SQL> select to_number('011','xxxxx') from dual;

TO_NUMBER('011','XXXXX')
------------------------
17

SQL> select to_number('000000e6','xxxxxxxxx') from dual;

TO_NUMBER('000000E6','XXXXXXXXX')
---------------------------------
230

--=================================================================================
data block的dump信息中ITL中的uba:0x00800554.00d6.28是由uba(undo block address).UBASQN.UBAREC
undo block address是00800554,是一个16进制数,可以通过如下函数转换为UBAFIL和UBABLK
验证如下:
--=================================================================================
SQL> select dbms_utility.data_block_address_file(to_number('00800554','xxxxxxx
x')) from dual;

DBMS_UTILITY.DATA_BLOCK_ADDRESS_FILE(TO_NUMBER('00800554','XXXXXXXXXX'))
------------------------------------------------------------------------
2

SQL> select dbms_utility.data_block_address_block(to_number('00800554','xxxxxx
xx')) from dual;

DBMS_UTILITY.DATA_BLOCK_ADDRESS_BLOCK(TO_NUMBER('00800554','XXXXXXXXXX'))
-------------------------------------------------------------------------
1364

SQL> select to_number('00d6','xxxxxxxxx') from dual;

TO_NUMBER('00D6','XXXXXXXXX')
-----------------------------
214
--=================================================================================
上面dump之后计算的信息和v$transaction的数据完全一致
SQL> select xidusn,xidslot,xidsqn,ubafil,ubablk,ubasqn,ubarec from v$transaction

2 ;

XIDUSN XIDSLOT XIDSQN UBAFIL UBABLK UBASQN UBAREC
---------- ---------- ---------- ---------- ---------- ---------- ----------
12 17 230 2 1364 214 40

SQL>

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/19602/viewspace-61745/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2007-12-07

  • 博文量
    717
  • 访问量
    5145789