回复: What is the meaning of SCN in change vector header?

From: 崔华 <allantreycn_at_yahoo.com.cn>
Date: Tue, 31 Aug 2010 20:14:31 +0800 (CST)
Message-ID: <627849.90470.qm_at_web15802.mail.cnb.yahoo.com>



CHANGE # 1 is op5.2, CHANGE # 2 is op5.1, CHANGE # 3 is op11.2, CHANGE #4 is op5.20.  
First of all, the four change vectors formed a redo record, the SCN recorded on the redo record is the commit SCN of that redo record, it must be the largest of this group change vectors, and here is 0x0000.0011211b.  
Secondly, CHANGE #4, it is op5.20, which stands for media recovery marker SCN, there is no media recovery operations, so it must be 0.  
Then, the smallest SCN must be CHANGE # 3, followed by CHANGE # 2 and CHANGE # 1, because at the real beginning of modifying a block the Oracle follow the following steps:
1. Find an interested transaction list (ITL) available in the block. 
2. Lock the row you are modifying. 
3. Generate the redo part of data describing the changes to the data block. 
4. Generate the undo part of data describing: 

- The inverse operation of data block user changes
  • The undo block changes in the undo segment
  • The undo segment block changes (if necessary) 5. Create the redo record and apply the changes to the blocks.   Note that the step 3 is before step 4, so the SCN of CHANGE # 3 is less than the SCN of CHANGE # 2, when all the required undo block has produced, oracle needs to go to the KTUXE ( Kernel Transaction Undo trans (X) action Entry) in the undo segment header for updating the UBA of the corresponding transaction, which is the last UBA (for the transaction rollback) in the undo chain, so the SCN of CHANGE # 2 is less than the SCN of CHANGE # 1.   Some of the above content is only my guess, not necessarily right, welcome the correction of you guys.

Best Regards
dbsnake

  • 10年8月24日,周二, Vit Spinka <vit.spinka_at_vitspinka.cz> 写道:

发件人: Vit Spinka <vit.spinka_at_vitspinka.cz> 主题: What is the meaning of SCN in change vector header? 收件人: oracle-l_at_freelists.org
日期: 2010年8月24日,周二,下午6:05

Hi all,

I'm digging through redo file dumps and came across something I cannot explain: why is SCN mentioned both in redo record header and change vector headers, and why do they differ?

[11.1.0.7 on Linux x86]

Let me show a simple example (single-row insert starting a transaction):

REDO RECORD - Thread:1 RBA: 0x00021f.00000006.0010 LEN: 0x01ec VLD: 0x05 SCN: 0x0000.0011211b SUBSCN:  1 08/23/2010 17:25:37 CHANGE #1 TYP:0 CLS:19 AFN:3 DBA:0x00c00090 OBJ:4294967295 SCN:0x0000.00112109 SEQ:  1 OP:5.2 ENC:0 ktudh redo: slt: 0x001b sqn: 0x000002dc flg: 0x0012 siz: 136 fbi: 0             uba: 0x00c00605.011b.2d    pxid:  0x0000.000.00000000 CHANGE #2 TYP:0 CLS:20 AFN:3 DBA:0x00c00605 OBJ:4294967295 SCN:0x0000.00112108 SEQ:  1 OP:5.1 ENC:0 ktudb redo: siz: 136 spc: 1774 flg: 0x0012 seq: 0x011b rec: 0x2d             xid:  0x0002.01b.000002dc ktubl redo: slt: 27 rci: 0 opc: 11.1 [objn: 72101 objd: 72101 tsn: 4] Undo type:  Regular undo        Begin trans    Last buffer split:  No Temp Object:  No
Tablespace Undo:  No
             0x00000000  prev ctl uba: 0x00c00605.011b.2c prev ctl max cmt scn:  0x0000.00111a11  prev tx cmt scn:  0x0000.00111a45 txn start scn:  0xffff.ffffffff  logon user: 88  prev brb: 12583535 prev bcl: 0 BuExt idx: 0 flg2: 0 KDO undo record:
KTB Redo
op: 0x03  ver: 0x01
compat bit: 4 (post-11) padding: 1
op: Z
KDO Op code: DRP row dependencies Disabled   xtype: XA flags: 0x00000000  bdba: 0x010002eb  hdba: 0x010002ea itli: 2  ispac: 0  maxfr: 4858
tabn: 0 slot: 1(0x1)
CHANGE #3 TYP:2 CLS: 1 AFN:4 DBA:0x010002eb OBJ:72101 SCN:0x0000.00110679 SEQ:  1 OP:11.2 ENC:0 KTB Redo
op: 0x01  ver: 0x01
compat bit: 4 (post-11) padding: 1
op: F  xid:  0x0002.01b.000002dc    uba: 0x00c00605.011b.2d KDO Op code: IRP row dependencies Disabled   xtype: XA flags: 0x00000000  bdba: 0x010002eb  hdba: 0x010002ea itli: 2  ispac: 0  maxfr: 4858
tabn: 0 slot: 1(0x1) size/delt: 25
fb: --H-FL-- lb: 0x2  cc: 3
null: ---

col  0: [ 4]  3d 64 4e 66
col  1: [ 7]  78 6e 08 17 12 1a 26
col  2: [ 8]  72 6f 77 20 2d 31 32 33

CHANGE #4 MEDIA RECOVERY MARKER SCN:0x0000.00000000 SEQ:  0 OP:5.20 ENC:0 session number   = 130
serial  number   = 212
transaction name =
version 185599744
audit sessionid 402054

The SCN I see there are:
REDO RECORD - SCN: 0x0000.0011211b

CHANGE #1 (undo data header) - SCN:0x0000.00112109
CHANGE #2 (undo data block) - SCN:0x0000.00112108
CHANGE #3 (redo - insert row piece) - SCN:0x0000.00110679
CHANGE #4 (transaction audit) - SCN:0x0000.00000000

I suppose the "correct one" is the one from REDO RECORD, but what the others mean?

Thanks for any clues

Vit

--
http://www.freelists.org/webpage/oracle-l





      

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Aug 31 2010 - 07:14:31 CDT

Original text of this message