© Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved.
Ver.2
(2016.07.18)
© Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved.
2011, Oracle Core Essential Internals for DBAs and Developers, Jonathan Lewis
It's so difficult to understand
only through the book.
I'd like to check internal
actual situation of oracle
with my own eyes
"Undo" mechanism as explained in Jonathan Lewis's book
© Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved.
2011, Oracle Core Essential Internals for DBAs and Developers, Jonathan Lewis
UPDATE Table A
SET col1 = ‘B’
AA
Redo
log
undo
Data
File
AB
A
B
Simple flow chart in oracle when processing Update statement
SGA
Undo Segment
Shared Pool Buffer Cache
© Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved.
Data Block
v$transaction
Undo Header
index state cflags wrap# uel scn dba
---------------------------------------------------------------------------------------------------------------------
0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000
0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000
0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000
Undo Block
ITL
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
Rows
block_row_dump:
tab 0, row 0, @0x1f88
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [10] 31 20 20 20 20 20 20 20 20 20
col 1: [ 1] 41 ASCII HEXA code 41
=> Value ‘A’
* Rec #0x1
BH
1. Initial state when a value of "A" is entered (The first stage before update)
SGA
Undo Segment
Shared Pool Buffer Cache
© Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved.
Data Block
v$transaction
ITL
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
Rows
block_row_dump:
tab 0, row 0, @0x1f88
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [10] 31 20 20 20 20 20 20 20 20 20
col 1: [ 1] 41
Undo Header
index state cflags wrap# uel scn dba
---------------------------------------------------------------------------------------------------------------------
0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000
0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000
0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000
Undo Block
* Rec #0x1
BH
BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000
st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [10] 31 20 20 20 20 20 20 20 20 20
col 1: [ 1] 41
UPDATE Table A
SET col1 = ‘B’
ASCII HEXA code 41
=> Value ‘A’
(The preparation stage before update)
1_1. State in which generating CU Block into Buffer Cache by selecting one from DB block
SGA
Undo Segment
Shared Pool Buffer Cache
© Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved.
Data Block
BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000
st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41
BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000
st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41
CR
ITL
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
Rows
block_row_dump:
tab 0, row 0, @0x1f88
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [10] 31 20 20 20 20 20 20 20 20 20
col 1: [ 1] 41
Undo Header
index state cflags wrap# uel scn dba
----------------------------------------------------------------------------------------------------------------
0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000
0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000
0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000
v$transaction
BH‘a438’XCU block is copied to
BH‘a1c8’XCU block
BH‘a438’block is changed from XCU to CR
0x643fa1c8
Undo Block
* Rec #0x1
BH
ASCII HEXA code 41
=> Value ‘A’
copy XCU block
change from
XCU to CR
0x643fa438
2. When executing Update statement, generates new CU block in Buffer Cache and changes from CU block to CR block
SGA
Undo Segment
Shared Pool Buffer Cache
© Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved.
Data Block
BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000
st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41
ITL
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
Rows
block_row_dump:
tab 0, row 0, @0x1f88
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [10] 31 20 20 20 20 20 20 20 20 20
col 1: [ 1] 41
Undo Header
index state cflags wrap# uel scn dba
---------------------------------------------------------------------------------------------------------------
0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000
0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000
0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000
V$transaction
XID_INFO UBA_INFO TXN_INFO
-------------- --------------- ------------------------------
addr : status : IDLE
xidusn : ubafil : start_date : 2015-12-10 10:52:46
xidslot : ubablk : ses_addr : 000000006B21CC20
xidsqn : ubasqn :
0000000069B01FB0
BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000
st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41
For processing TX,
Address is allocated in v$transaction data at
the very first
Undo Block
* Rec #0x1
BH
ASCII HEXA code 41
=> Value ‘A’
2_1. Address data is generated in v$transaction. (Allocating memory about Row Cache new tx)
SGA
Undo Segment
Shared Pool Buffer Cache
© Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved.
Data Block
V$transaction
XID_INFO UBA_INFO TXN_INFO
-------------- --------------- ------------------------------
addr : status : IDLE
xidusn : ubafil : start_date : 2015-12-10 10:52:46
xidslot : ubablk : ses_addr : 000000006B21CC20
xidsqn : ubasqn :
ITL
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
Rows
block_row_dump:
tab 0, row 0, @0x1f88
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [10] 31 20 20 20 20 20 20 20 20 20
col 1: [ 1] 41 ASCII HEXA code 41
=> Value ‘A’
Undo Header
index state cflags wrap# uel scn dba
----------------------------------------------------------------------------------------------------------------
0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000
0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000
0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000
Undo Block
* Rec #0x1
BH
BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000
st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41
BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000
st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 410000000069B01FB0
7
After allocating address,
USN(Undo Segment Number) is
registered in v$transaction data
for the second time
Undo Segment
Number
3. Xid usn's value is allocated in v$transaction. (No. 7 usn in here)
SGA
Undo Segment
Shared Pool Buffer Cache
© Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved.
Data Block
V$transaction
XID_INFO UBA_INFO TXN_INFO
-------------- --------------- ------------------------------
addr : status : IDLE
xidusn : ubafil : start_date : 2015-12-10 10:52:46
xidslot : ubablk : ses_addr : 000000006B21CC20
xidsqn : ubasqn :
0000000069B01FB0
7
Undo Segment
Number
BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000
st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41
BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000
st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41
ITL
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
Rows
block_row_dump:
tab 0, row 0, @0x1f88
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [10] 31 20 20 20 20 20 20 20 20 20
col 1: [ 1] 41 ASCII HEXA code 41
=> Value ‘A’
Undo Header
index state cflags wrap# uel scn dba
----------------------------------------------------------------------------------------------------------------
0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000
0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000
0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000
Undo Block
* Rec #0x1 slt: 0x00 objn: 70670 (0x0001140e) objd: Undo type: Regular undo
Begin trans Last buffer split: No
ncol: 2 nnew: 1 size: 0 Vector content: col 1: [ 1] 41
BH (0x643e4b50) file#: 6 rdba: 0x018000a2 (6/162) class: 30 ba: 0x64184000
st: XCURRENT md: EXCL fpin: 'kcbwh2: kcbchg1' tch: 0
10 0x80 0x04ed 0x0000 0x0000.003dbe4d
Undo slot
active
0x018000a2
Undo Block
Address
Before image
value ‘A’
4. In Undo segment, Slot value is changed from 9 to 10
SGA
Undo Segment
Shared Pool Buffer Cache
© Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved.
Data Block
V$transaction
XID_INFO UBA_INFO TXN_INFO
-------------- --------------- ------------------------------
addr : status : IDLE
xidusn : ubafil : start_date : 2015-12-10 10:52:46
xidslot : ubablk : ses_addr : 000000006B21CC20
xidsqn : ubasqn :
0000000069B01FB0
7
Undo Segment
Number
ITL
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
Rows
block_row_dump:
tab 0, row 0, @0x1f88
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [10] 31 20 20 20 20 20 20 20 20 20
col 1: [ 1] 41 ASCII HEXA code 41
=> Value ‘A’
Undo Header
index state cflags wrap# uel scn dba
----------------------------------------------------------------------------------------------------------------
0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000
0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000
0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000
Undo Block
* Rec #0x1 slt: 0x00 objn: 70670 (0x0001140e) objd: Undo type: Regular undo
Begin trans Last buffer split: No
ncol: 2 nnew: 1 size: 0 Vector content: col 1: [ 1] 41
BH (0x643e4b50) file#: 6 rdba: 0x018000a2 (6/162) class: 30 ba: 0x64184000
st: XCURRENT md: EXCL fpin: 'kcbwh2: kcbchg1' tch: 0
Undo Block
Address
Before image
value ‘A’
10 0x80 0x04ed 0x0000 0x0000.003dbe4d 0x018000a2
BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000
st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41
BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000
st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41tl: 16 fb: --H-FL-- lb: 0x2 cc: 2
0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a
0x02 0x0007.000.000004ed 0x018000a2.01d5.01 ---- 1 fsc 0x0000.00000000
col 1: [ 1] 42
Update ‘A’ to ‘B’
of CU block
CleanOut: itl No.1 change (--U-  C---)
Txn data change: itl No.2 change (Xid,Uba)
Lock Byte change: 0x1  0x2
Undo slot
active
5. Update value A to B of XCU block in Buffer Cache
SGA
Undo Segment
Shared Pool Buffer Cache
© Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved.
Data Block
Undo Header
index state cflags wrap# uel scn dba
----------------------------------------------------------------------------------------------------------------
0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000
0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000
0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000
Undo Block
* Rec #0x1 slt: 0x00 objn: 70670 (0x0001140e) objd: Undo type: Regular undo
Begin trans Last buffer split: No
ncol: 2 nnew: 1 size: 0 Vector content: col 1: [ 1] 41
BH (0x643e4b50) file#: 6 rdba: 0x018000a2 (6/162) class: 30 ba: 0x64184000
st: XCURRENT md: EXCL fpin: 'kcbwh2: kcbchg1' tch: 0
Undo Block
Address
Before image
value ‘A’
10 0x80 0x04ed 0x0000 0x0000.003dbe4d 0x018000a2
ITL
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
Rows
block_row_dump:
tab 0, row 0, @0x1f88
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [10] 31 20 20 20 20 20 20 20 20 20
col 1: [ 1] 41 ASCII HEXA code 41
=> Value ‘A’
V$transaction
XID_INFO UBA_INFO TXN_INFO
-------------- --------------- ------------------------------
addr : status : IDLE
xidusn : ubafil : start_date : 2015-12-10 10:52:46
xidslot : ubablk : ses_addr : 000000006B21CC20
xidsqn : ubasqn :
BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000
st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41
BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000
st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a
0x02 0x0007.000.000004ed 0x018000a2.01d5.01 ---- 1 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x2 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 42
7
0000000069B01FB0
1
1261
162
ACTIVE
6
469
Registered with the order as below in
v$transaction.
* addr ⟶ xidusn ⟶ xidslot, xidsqn, ubablk
Undo slot
active
6. Allocate into other column except xid and uba in v$transaction
SGA
Undo Segment
Shared Pool Buffer Cache
© Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved.
Data Block
V$transaction
XID_INFO UBA_INFO TXN_INFO
-------------- --------------- ------------------------------
addr : status : IDLE
xidusn : ubafil : start_date : 2015-12-10 10:52:46
xidslot : ubablk : ses_addr : 000000006B21CC20
xidsqn : ubasqn :
ITL
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
Rows
block_row_dump:
tab 0, row 0, @0x1f88
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [10] 31 20 20 20 20 20 20 20 20 20
col 1: [ 1] 41 ASCII HEXA code 41
=> Value ‘A’
BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000
st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41
BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000
st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a
0x02 0x0007.000.000004ed 0x018000a2.01d5.01 ---- 1 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x2 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 42
--U- 1 fsc 0x0000.003dbe4e
Undo Header
index state cflags wrap# uel scn dba
----------------------------------------------------------------------------------------------------------------
0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000
0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000
0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000
Undo Block
* Rec #0x1 slt: 0x00 objn: 70670 (0x0001140e) objd: Undo type: Regular undo
Begin trans Last buffer split: No
ncol: 2 nnew: 1 size: 0 Vector content: col 1: [ 1] 41
BH (0x643e4b50) file#: 6 rdba: 0x018000a2 (6/162) class: 30 ba: 0x64184000
st: XCURRENT md: EXCL fpin: 'kcbwh2: kcbchg1' tch: 0
Undo Block
Address
Before image
value ‘A’
Undo slot
active
10 0x80 0x04ed 0x0000 0x0000.003dbe4d 0x018000a2
Allocating equal scn to Itl slot and
undo header slot
COMMIT ;
7. Commit execute (Allocating equal scn to Itl slot and undo header slot)
After commit, TX data is deleted in
v$transaction
SGA
Undo Segment
Shared Pool Buffer Cache
© Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved.
Data Block
V$transaction
XID_INFO UBA_INFO TXN_INFO
-------------- --------------- ------------------------------
addr : status : IDLE
xidusn : ubafil : start_date : 2015-12-10 10:52:46
xidslot : ubablk : ses_addr : 000000006B21CC20
xidsqn : ubasqn :
BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000
st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41
BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000
st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a
0x02 0x0007.000.000004ed 0x018000a2.01d5.01 ---- 1 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x2 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 42
ITL
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
Rows
block_row_dump:
tab 0, row 0, @0x1f88
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [10] 31 20 20 20 20 20 20 20 20 20
col 1: [ 1] 41
tl: 16 fb: --H-FL-- lb: 0x2 cc: 2
col 0: [10] 31 20 20 20 20 20 20 20 20 20
col 1: [ 1] 42
0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a
0x02 0x0007.000.000004ed 0x018000a2.01d5.01 --U- 1 fsc 0x0000.003dbe4e
Value 'B' reflects
Data block
Undo Header
index state cflags wrap# uel scn dba
----------------------------------------------------------------------------------------------------------------
0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000
0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000
0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000
Undo Block
* Rec #0x1 slt: 0x00 objn: 70670 (0x0001140e) objd: Undo type: Regular undo
Begin trans Last buffer split: No
ncol: 2 nnew: 1 size: 0 Vector content: col 1: [ 1] 41
BH (0x643e4b50) file#: 6 rdba: 0x018000a2 (6/162) class: 30 ba: 0x64184000
st: XCURRENT md: EXCL fpin: 'kcbwh2: kcbchg1' tch: 0
Undo Block
Address
Before image
value ‘A’
Undo slot
active
10 0x80 0x04ed 0x0000 0x018000a20x0000.003dbe4e
BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000
st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a
0x02 0x0007.000.000004ed 0x018000a2.01d5.01 --U- 1 fsc 0x0000.003dbe4e
tl: 16 fb: --H-FL-- lb: 0x2 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 42
Checkpoint ;
8. Executing Check point (CU block reflects disk block)
SGA
Undo Segment
Shared Pool Buffer Cache
© Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved.
Data Block
BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000
st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41
BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000
st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a
0x02 0x0007.000.000004ed 0x018000a2.01d5.01 --U- 1 fsc 0x0000.003dbe4e
tl: 16 fb: --H-FL-- lb: 0x2 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 42
V$transaction
XID_INFO UBA_INFO TXN_INFO
-------------- --------------- ------------------------------
addr : status : IDLE
xidusn : ubafil : start_date : 2015-12-10 10:52:46
xidslot : ubablk : ses_addr : 000000006B21CC20
xidsqn : ubasqn :
ITL
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a
0x02 0x0007.000.000004ed 0x018000a2.01d5.01 --U- 1 fsc 0x0000.003dbe4e
Rows
block_row_dump:
tab 0, row 0, @0x1f88
tl: 16 fb: --H-FL-- lb: 0x2 cc: 2
col 0: [10] 31 20 20 20 20 20 20 20 20 20
col 1: [ 1] 42
Undo Header
index state cflags wrap# uel scn dba
----------------------------------------------------------------------------------------------------------------
0x00 10 0x80 0x04ed 0x0000 0x0000.003dbe4e 0x018000a2
0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000
0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000
Undo Block
* Rec #0x1 slt: 0x00 objn: 70670 (0x0001140e) objd: Undo type: Regular undo
Begin trans Last buffer split: No
ncol: 2 nnew: 1 size: 0 Vector content: col 1: [ 1] 41
BH (0x643e4b50) file#: 6 rdba: 0x018000a2 (6/162) class: 30 ba: 0x64184000
st: XCURRENT md: EXCL fpin: 'kcbwh2: kcbchg1' tch: 0
Undo Block
Address
Before image
value ‘A’
Undo slot
active
Summary : DML Operation in a Data Block
Oracle Deep Internal
Blog
Video
E-mail
NAVER http://cafe.naver.com/playexem
ITPUB http://blog.itpub.net/31135309/
Wordpress https://playexem.wordpress.com/
Slideshare http://www.slideshare.net/playexem
Youtube https://www.youtube.com/channel/UC
5wKR_-A0eL_Pn_EMzoauJg
Research & Contents Team Sook jin, Kim
edu@ex-em.com
For more information, or to schedule an on-site
education, contact via blog or e-mail

Oracle Deep Internal 1 (ver.2)

  • 1.
    © Copyrights 2001~2016,EXEM CO.,LTD. All Rights Reserved. Ver.2 (2016.07.18)
  • 2.
    © Copyrights 2001~2016,EXEM CO.,LTD. All Rights Reserved. 2011, Oracle Core Essential Internals for DBAs and Developers, Jonathan Lewis It's so difficult to understand only through the book. I'd like to check internal actual situation of oracle with my own eyes "Undo" mechanism as explained in Jonathan Lewis's book
  • 3.
    © Copyrights 2001~2016,EXEM CO.,LTD. All Rights Reserved. 2011, Oracle Core Essential Internals for DBAs and Developers, Jonathan Lewis UPDATE Table A SET col1 = ‘B’ AA Redo log undo Data File AB A B Simple flow chart in oracle when processing Update statement
  • 4.
    SGA Undo Segment Shared PoolBuffer Cache © Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved. Data Block v$transaction Undo Header index state cflags wrap# uel scn dba --------------------------------------------------------------------------------------------------------------------- 0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000 0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000 0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000 Undo Block ITL Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 Rows block_row_dump: tab 0, row 0, @0x1f88 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 ASCII HEXA code 41 => Value ‘A’ * Rec #0x1 BH 1. Initial state when a value of "A" is entered (The first stage before update)
  • 5.
    SGA Undo Segment Shared PoolBuffer Cache © Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved. Data Block v$transaction ITL Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 Rows block_row_dump: tab 0, row 0, @0x1f88 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 Undo Header index state cflags wrap# uel scn dba --------------------------------------------------------------------------------------------------------------------- 0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000 0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000 0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000 Undo Block * Rec #0x1 BH BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000 st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 UPDATE Table A SET col1 = ‘B’ ASCII HEXA code 41 => Value ‘A’ (The preparation stage before update) 1_1. State in which generating CU Block into Buffer Cache by selecting one from DB block
  • 6.
    SGA Undo Segment Shared PoolBuffer Cache © Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved. Data Block BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000 st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000 st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 CR ITL Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 Rows block_row_dump: tab 0, row 0, @0x1f88 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 Undo Header index state cflags wrap# uel scn dba ---------------------------------------------------------------------------------------------------------------- 0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000 0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000 0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000 v$transaction BH‘a438’XCU block is copied to BH‘a1c8’XCU block BH‘a438’block is changed from XCU to CR 0x643fa1c8 Undo Block * Rec #0x1 BH ASCII HEXA code 41 => Value ‘A’ copy XCU block change from XCU to CR 0x643fa438 2. When executing Update statement, generates new CU block in Buffer Cache and changes from CU block to CR block
  • 7.
    SGA Undo Segment Shared PoolBuffer Cache © Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved. Data Block BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000 st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 ITL Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 Rows block_row_dump: tab 0, row 0, @0x1f88 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 Undo Header index state cflags wrap# uel scn dba --------------------------------------------------------------------------------------------------------------- 0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000 0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000 0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000 V$transaction XID_INFO UBA_INFO TXN_INFO -------------- --------------- ------------------------------ addr : status : IDLE xidusn : ubafil : start_date : 2015-12-10 10:52:46 xidslot : ubablk : ses_addr : 000000006B21CC20 xidsqn : ubasqn : 0000000069B01FB0 BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000 st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 For processing TX, Address is allocated in v$transaction data at the very first Undo Block * Rec #0x1 BH ASCII HEXA code 41 => Value ‘A’ 2_1. Address data is generated in v$transaction. (Allocating memory about Row Cache new tx)
  • 8.
    SGA Undo Segment Shared PoolBuffer Cache © Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved. Data Block V$transaction XID_INFO UBA_INFO TXN_INFO -------------- --------------- ------------------------------ addr : status : IDLE xidusn : ubafil : start_date : 2015-12-10 10:52:46 xidslot : ubablk : ses_addr : 000000006B21CC20 xidsqn : ubasqn : ITL Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 Rows block_row_dump: tab 0, row 0, @0x1f88 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 ASCII HEXA code 41 => Value ‘A’ Undo Header index state cflags wrap# uel scn dba ---------------------------------------------------------------------------------------------------------------- 0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000 0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000 0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000 Undo Block * Rec #0x1 BH BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000 st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000 st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 410000000069B01FB0 7 After allocating address, USN(Undo Segment Number) is registered in v$transaction data for the second time Undo Segment Number 3. Xid usn's value is allocated in v$transaction. (No. 7 usn in here)
  • 9.
    SGA Undo Segment Shared PoolBuffer Cache © Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved. Data Block V$transaction XID_INFO UBA_INFO TXN_INFO -------------- --------------- ------------------------------ addr : status : IDLE xidusn : ubafil : start_date : 2015-12-10 10:52:46 xidslot : ubablk : ses_addr : 000000006B21CC20 xidsqn : ubasqn : 0000000069B01FB0 7 Undo Segment Number BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000 st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000 st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 ITL Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 Rows block_row_dump: tab 0, row 0, @0x1f88 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 ASCII HEXA code 41 => Value ‘A’ Undo Header index state cflags wrap# uel scn dba ---------------------------------------------------------------------------------------------------------------- 0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000 0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000 0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000 Undo Block * Rec #0x1 slt: 0x00 objn: 70670 (0x0001140e) objd: Undo type: Regular undo Begin trans Last buffer split: No ncol: 2 nnew: 1 size: 0 Vector content: col 1: [ 1] 41 BH (0x643e4b50) file#: 6 rdba: 0x018000a2 (6/162) class: 30 ba: 0x64184000 st: XCURRENT md: EXCL fpin: 'kcbwh2: kcbchg1' tch: 0 10 0x80 0x04ed 0x0000 0x0000.003dbe4d Undo slot active 0x018000a2 Undo Block Address Before image value ‘A’ 4. In Undo segment, Slot value is changed from 9 to 10
  • 10.
    SGA Undo Segment Shared PoolBuffer Cache © Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved. Data Block V$transaction XID_INFO UBA_INFO TXN_INFO -------------- --------------- ------------------------------ addr : status : IDLE xidusn : ubafil : start_date : 2015-12-10 10:52:46 xidslot : ubablk : ses_addr : 000000006B21CC20 xidsqn : ubasqn : 0000000069B01FB0 7 Undo Segment Number ITL Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 Rows block_row_dump: tab 0, row 0, @0x1f88 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 ASCII HEXA code 41 => Value ‘A’ Undo Header index state cflags wrap# uel scn dba ---------------------------------------------------------------------------------------------------------------- 0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000 0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000 0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000 Undo Block * Rec #0x1 slt: 0x00 objn: 70670 (0x0001140e) objd: Undo type: Regular undo Begin trans Last buffer split: No ncol: 2 nnew: 1 size: 0 Vector content: col 1: [ 1] 41 BH (0x643e4b50) file#: 6 rdba: 0x018000a2 (6/162) class: 30 ba: 0x64184000 st: XCURRENT md: EXCL fpin: 'kcbwh2: kcbchg1' tch: 0 Undo Block Address Before image value ‘A’ 10 0x80 0x04ed 0x0000 0x0000.003dbe4d 0x018000a2 BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000 st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000 st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41tl: 16 fb: --H-FL-- lb: 0x2 cc: 2 0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a 0x02 0x0007.000.000004ed 0x018000a2.01d5.01 ---- 1 fsc 0x0000.00000000 col 1: [ 1] 42 Update ‘A’ to ‘B’ of CU block CleanOut: itl No.1 change (--U-  C---) Txn data change: itl No.2 change (Xid,Uba) Lock Byte change: 0x1  0x2 Undo slot active 5. Update value A to B of XCU block in Buffer Cache
  • 11.
    SGA Undo Segment Shared PoolBuffer Cache © Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved. Data Block Undo Header index state cflags wrap# uel scn dba ---------------------------------------------------------------------------------------------------------------- 0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000 0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000 0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000 Undo Block * Rec #0x1 slt: 0x00 objn: 70670 (0x0001140e) objd: Undo type: Regular undo Begin trans Last buffer split: No ncol: 2 nnew: 1 size: 0 Vector content: col 1: [ 1] 41 BH (0x643e4b50) file#: 6 rdba: 0x018000a2 (6/162) class: 30 ba: 0x64184000 st: XCURRENT md: EXCL fpin: 'kcbwh2: kcbchg1' tch: 0 Undo Block Address Before image value ‘A’ 10 0x80 0x04ed 0x0000 0x0000.003dbe4d 0x018000a2 ITL Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 Rows block_row_dump: tab 0, row 0, @0x1f88 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 ASCII HEXA code 41 => Value ‘A’ V$transaction XID_INFO UBA_INFO TXN_INFO -------------- --------------- ------------------------------ addr : status : IDLE xidusn : ubafil : start_date : 2015-12-10 10:52:46 xidslot : ubablk : ses_addr : 000000006B21CC20 xidsqn : ubasqn : BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000 st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000 st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a 0x02 0x0007.000.000004ed 0x018000a2.01d5.01 ---- 1 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x2 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 42 7 0000000069B01FB0 1 1261 162 ACTIVE 6 469 Registered with the order as below in v$transaction. * addr ⟶ xidusn ⟶ xidslot, xidsqn, ubablk Undo slot active 6. Allocate into other column except xid and uba in v$transaction
  • 12.
    SGA Undo Segment Shared PoolBuffer Cache © Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved. Data Block V$transaction XID_INFO UBA_INFO TXN_INFO -------------- --------------- ------------------------------ addr : status : IDLE xidusn : ubafil : start_date : 2015-12-10 10:52:46 xidslot : ubablk : ses_addr : 000000006B21CC20 xidsqn : ubasqn : ITL Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 Rows block_row_dump: tab 0, row 0, @0x1f88 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 ASCII HEXA code 41 => Value ‘A’ BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000 st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000 st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a 0x02 0x0007.000.000004ed 0x018000a2.01d5.01 ---- 1 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x2 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 42 --U- 1 fsc 0x0000.003dbe4e Undo Header index state cflags wrap# uel scn dba ---------------------------------------------------------------------------------------------------------------- 0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000 0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000 0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000 Undo Block * Rec #0x1 slt: 0x00 objn: 70670 (0x0001140e) objd: Undo type: Regular undo Begin trans Last buffer split: No ncol: 2 nnew: 1 size: 0 Vector content: col 1: [ 1] 41 BH (0x643e4b50) file#: 6 rdba: 0x018000a2 (6/162) class: 30 ba: 0x64184000 st: XCURRENT md: EXCL fpin: 'kcbwh2: kcbchg1' tch: 0 Undo Block Address Before image value ‘A’ Undo slot active 10 0x80 0x04ed 0x0000 0x0000.003dbe4d 0x018000a2 Allocating equal scn to Itl slot and undo header slot COMMIT ; 7. Commit execute (Allocating equal scn to Itl slot and undo header slot) After commit, TX data is deleted in v$transaction
  • 13.
    SGA Undo Segment Shared PoolBuffer Cache © Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved. Data Block V$transaction XID_INFO UBA_INFO TXN_INFO -------------- --------------- ------------------------------ addr : status : IDLE xidusn : ubafil : start_date : 2015-12-10 10:52:46 xidslot : ubablk : ses_addr : 000000006B21CC20 xidsqn : ubasqn : BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000 st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000 st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a 0x02 0x0007.000.000004ed 0x018000a2.01d5.01 ---- 1 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x2 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 42 ITL Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 Rows block_row_dump: tab 0, row 0, @0x1f88 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 tl: 16 fb: --H-FL-- lb: 0x2 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 42 0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a 0x02 0x0007.000.000004ed 0x018000a2.01d5.01 --U- 1 fsc 0x0000.003dbe4e Value 'B' reflects Data block Undo Header index state cflags wrap# uel scn dba ---------------------------------------------------------------------------------------------------------------- 0x00 9 0x00 0x04ec 0x0001 0x0000.003d6d72 0x00000000 0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000 0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000 Undo Block * Rec #0x1 slt: 0x00 objn: 70670 (0x0001140e) objd: Undo type: Regular undo Begin trans Last buffer split: No ncol: 2 nnew: 1 size: 0 Vector content: col 1: [ 1] 41 BH (0x643e4b50) file#: 6 rdba: 0x018000a2 (6/162) class: 30 ba: 0x64184000 st: XCURRENT md: EXCL fpin: 'kcbwh2: kcbchg1' tch: 0 Undo Block Address Before image value ‘A’ Undo slot active 10 0x80 0x04ed 0x0000 0x018000a20x0000.003dbe4e BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000 st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a 0x02 0x0007.000.000004ed 0x018000a2.01d5.01 --U- 1 fsc 0x0000.003dbe4e tl: 16 fb: --H-FL-- lb: 0x2 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 42 Checkpoint ; 8. Executing Check point (CU block reflects disk block)
  • 14.
    SGA Undo Segment Shared PoolBuffer Cache © Copyrights 2001~2016, EXEM CO.,LTD. All Rights Reserved. Data Block BH (0x643fa438) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643ba000 st: CR md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 --U- 1 fsc 0x0000.003dbe3a 0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000 tl: 16 fb: --H-FL-- lb: 0x1 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 41 BH (0x643fa1c8) file#: 5 rdba: 0x0140dcad (5/56493) class: 1 ba: 0x643b6000 st: XCURRENT md: EXCL fpin: 'kdswh11: kdst_fetch' tch: 1 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a 0x02 0x0007.000.000004ed 0x018000a2.01d5.01 --U- 1 fsc 0x0000.003dbe4e tl: 16 fb: --H-FL-- lb: 0x2 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 42 V$transaction XID_INFO UBA_INFO TXN_INFO -------------- --------------- ------------------------------ addr : status : IDLE xidusn : ubafil : start_date : 2015-12-10 10:52:46 xidslot : ubablk : ses_addr : 000000006B21CC20 xidsqn : ubasqn : ITL Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.000.00000534 0x018000d2.01e6.01 C--- 0 scn 0x0000.003dbe3a 0x02 0x0007.000.000004ed 0x018000a2.01d5.01 --U- 1 fsc 0x0000.003dbe4e Rows block_row_dump: tab 0, row 0, @0x1f88 tl: 16 fb: --H-FL-- lb: 0x2 cc: 2 col 0: [10] 31 20 20 20 20 20 20 20 20 20 col 1: [ 1] 42 Undo Header index state cflags wrap# uel scn dba ---------------------------------------------------------------------------------------------------------------- 0x00 10 0x80 0x04ed 0x0000 0x0000.003dbe4e 0x018000a2 0x01 9 0x00 0x04ec 0x0002 0x0000.003d6d72 0x00000000 0x02 9 0x00 0x04ec 0x0003 0x0000.003d6d72 0x00000000 Undo Block * Rec #0x1 slt: 0x00 objn: 70670 (0x0001140e) objd: Undo type: Regular undo Begin trans Last buffer split: No ncol: 2 nnew: 1 size: 0 Vector content: col 1: [ 1] 41 BH (0x643e4b50) file#: 6 rdba: 0x018000a2 (6/162) class: 30 ba: 0x64184000 st: XCURRENT md: EXCL fpin: 'kcbwh2: kcbchg1' tch: 0 Undo Block Address Before image value ‘A’ Undo slot active Summary : DML Operation in a Data Block
  • 15.
    Oracle Deep Internal Blog Video E-mail NAVERhttp://cafe.naver.com/playexem ITPUB http://blog.itpub.net/31135309/ Wordpress https://playexem.wordpress.com/ Slideshare http://www.slideshare.net/playexem Youtube https://www.youtube.com/channel/UC 5wKR_-A0eL_Pn_EMzoauJg Research & Contents Team Sook jin, Kim edu@ex-em.com For more information, or to schedule an on-site education, contact via blog or e-mail