20_深入解析Oracle undo原理(4)_ktuxc詳解

orastar發表於2020-03-15

1          問題描述

KTUXC(UNDO TRANSACTION CONTROL) 表示回滾段事務控制,是undo 段頭塊中的一部分,使用CHD (Commit Head)和CTL (Commit Tail)快速定位該回滾段中可用的slot number。結構如下圖所示,

                                             

2          KTUXC 結構解析

SYS@source>select * from orastar.undo_test;

 

C1                             C2

------------------------------ ------------------------------

4                              222

2                              12

3                              123

 

SYS@source>update orastar.undo_test set c2='666' where c1=4;

 

1 row updated.

 

 

select xidusn,

xidslot,

xidsqn,

ubafil,

ubablk,

ubasqn,

ubarec,

used_ublk,

used_urec

from v$transaction;

 

 

 

 oradebug setmypid

alter system dump undo header '_SYSSMU14$';

oradebug close_trace

oradebug tracefile_name

 

  

【欄位解釋】

SEQ: Sequence number of the last block of the undo segment.

CHD (Commit Head): Head of the chain of the list of committed transactions sorted by increasing SCN (this points to an entry in the transaction table)

CTL (Commit Tail): Tail of the chain of the list of committed transactions, sorted by SCN (this points to an

entry in the transaction table).

INC: High water mark for incarnation number (increases by steps of 1024).

NFB: Number of nonempty slots in the free block pool.

MGC: Magic number for test of coherence (for AUM segments this value is 0x8201).

XTS: Tx table entry location from bottom of KCBH.

FLG: Value 1. Tx table has been converted from an earlier version.

OPT: Value for the OPTIMAL parameter.

UBA (Control UBA): The UBA of the undo record allowing rollback of the Tx table.

SCN (Control SCN): The committed SCN of the transaction that “rolled out” of the Tx table  

 

3          驗證chd 欄位

      驗證chd 欄位是否為下一個待使用的usn slot,

create undo tablespace undo6 datafile '/oradata/htdb/undo6.dbf' size 256K autoextend off;

alter system set undo_tablespace=undo6;

 

update orastar.undo_test set c2='666' where c1=4;

 

oradebug setmypid

alter system dump undo header '_SYSSMU101$';

oradebug close_trace

oradebug tracefile_name

 

 

  

4          Tx table 的排序

  Tx table slot 的排序,從 CHD (Commit Head) 開始,通過KTUXEUEL指向下一個slot,直到ktuxeslt等於CTL (Commit Tail)時KTUXEUEL為-1。所有usn中INACTIVE slot以KTUXESCNB和KTUXESLT升序排列。

 

5          總結

ktuxc 使用單向連結串列結構控制ktuxe 中待使用的 INACTIVE slot ,從CHD (Commit Head)開始CTL (Commit Tail)結束,以KTUXESCNB和KTUXESLT升序排列。


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31442014/viewspace-2680395/,如需轉載,請註明出處,否則將追究法律責任。

相關文章