The Codex of Business Writing Software for Real-World Solutions 2.pptx
[ODI] chapter1 When Update statement is executed, How does oracle undo work?
1. Oracle Deep Internal report no. 001
When Update statement is executed,
How does oracle undo work?
Research & Contents Team
2. When Update statement is executed,
How does oracle undo work?
01
Lee Kun Oh (이근오) kolee@nate.com
Kwon Kon Woo (권건우) redpine@ex-em.com
3. 2011, Oracle Core Essential Internals for DBAs and Developers, Jonathan Lewis
"Undo" mechanism as explained in Jonathan Lewis's book
It's so difficult to
understand only through
the book.
I'd like to check internal
actual situation of oracle
with my own eyes
4. Simple flow chart in oracle when processing Update statement
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
5. SGA
Undo SegmentData Block
Shared Pool Buffer Cache
1. Initial state when a value of "A" is entered (The first stage before update)
v$transaction
Undo Header
index state cflags wrap# uel scn dba parent-xid nub
-------------------------------------------------------------------------------------------
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
6. SGA
Undo SegmentData Block
Shared Pool Buffer Cache
1_1. State in which generating CU Block into Buffer Cache by selecting one from DB block
(The preparation stage before update)
v$transaction
Undo Header
index state cflags wrap# uel scn dba parent-xid nub
-------------------------------------------------------------------------------------------
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
* Rec #0x1
BH
ASCII HEXA code 41
=> Value ‘A’
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’
16. Oracle Deep Internal
More information https://youtu.be/s304cY8-IjMYouku
Blog
Video
E-mail
NAVER http://cafe.naver.com/playexem
ITPUB http://blog.itpub.net/31135309/
Wordpress https://playexem.wordpress.com/
Youtube https://www.youtube.com/channel/
UC5wKR_-A0eL_Pn_EMzoauJg
playexem@ex-em.com
playexem@naver.com
For more information, or to schedule an on-site
education, contact via blog or e-mail
Kon Woo, Kwon Kun Oh, Lee
Sook jin, Kim Dae Deok, Lee