oracle中一個事務是如何使用redo的以及redo record和change vector的關係
oracle使用redo來恢復應該是以redo record為單位的
[@more@]SQL> select * from tt;
ID NAME
---------- --------------------
1 a
2 b
3 c
SQL> update tt set name='e';
3 rows updated.
SQL> commit;
Commit complete.
SQL> alter system dump logfile 'E:ORACLEORADATATESTREDO04.LOG';
System altered.
SQL> select distinct sid from v$mystat;
SID
----------
7
SQL> select sid,serial#,process from v$session where sid=7;
SID SERIAL# PROCESS
---------- ---------- ------------------------------------------------
7 43 2360:4200
--================================
REDO RECORD - Thread:1 RBA: 0x000056.0000c741.0010 LEN: 0x0250 VLD: 0x05
SCN: 0x0000.0080d6cf SUBSCN: 1 01/27/2013 12:42:17
--================================
--這裡的change就是指change vectors,就是人們常說的改變向量,我這個例子裡
CHANGE #1就是在undo segment header block裡分配slot,slot號是slt: 0x001e
--================================
CHANGE #1 TYP:0 CLS:39 AFN:5 DBA:0x01400090 OBJ:4294967295 SCN:0x0000.0080d6bf SEQ:1 OP:5.2 ENC:0 RBL:0
ktudh redo: slt: 0x001e sqn: 0x00001620 flg: 0x0012 siz: 156 fbi: 0
uba: 0x014015fd.06e0.21 pxid: 0x0000.000.00000000
--================================
--change #2是undo block,用來保留修改前的資料a,a的ascii碼的16進位制數是61,從change #2的最下面
可以找到:col 1: [ 1] 61
--================================
CHANGE #2 TYP:0 CLS:40 AFN:5 DBA:0x014015fd OBJ:4294967295 SCN:0x0000.0080d6be SEQ:3 OP:5.1 ENC:0 RBL:0
ktudb redo: siz: 156 spc: 3458 flg: 0x0012 seq: 0x06e0 rec: 0x21
xid: 0x000c.01e.00001620
ktubl redo: slt: 30 rci: 0 opc: 11.1 [objn: 19949 objd: 19949 tsn: 4]
Undo type: Regular undo Begin trans Last buffer split: No
Temp Object: No
Tablespace Undo: No
0x00000000 prev ctl uba: 0x014015fd.06e0.1e
prev ctl max cmt scn: 0x0000.0080d08c prev tx cmt scn: 0x0000.0080d097
txn start scn: 0xffff.ffffffff logon user: 56 prev brb: 20977146 prev bcl: 0 BuExt idx: 0 flg2: 0
KDO undo record:
KTB Redo
op: 0x03 ver: 0x01
compat bit: 4 (post-11) padding: 0
op: Z
KDO Op code: URP row dependencies Disabled
xtype: XA flags: 0x00000000 bdba: 0x01000cf3 hdba: 0x01000cf2
itli: 2 ispac: 0 maxfr: 4858
tabn: 0 slot: 0(0x0) flag: 0x2c lock: 0 ckix: 0
ncol: 2 nnew: 1 size: 0
col 1: [ 1] 61
--===========================
change #3就是對資料庫block的修改了。
--===========================
CHANGE #3 TYP:0 CLS:1 AFN:4 DBA:0x01000cf3 OBJ:19949 SCN:0x0000.0080d6a6 SEQ:3 OP:11.5 ENC:0 RBL:0
KTB Redo
op: 0x01 ver: 0x01
compat bit: 4 (post-11) padding: 0
op: F xid: 0x000c.01e.00001620 uba: 0x014015fd.06e0.21
KDO Op code: URP row dependencies Disabled
xtype: XA flags: 0x00000000 bdba: 0x01000cf3 hdba: 0x01000cf2
itli: 2 ispac: 0 maxfr: 4858
tabn: 0 slot: 0(0x0) flag: 0x2c lock: 2 ckix: 0
ncol: 2 nnew: 1 size: 0
col 1: [ 1] 65
--===============================
change #4記錄的貌似是提交資訊以及發起這個事務的session以及client端的一些資訊。
--===============================
CHANGE #4 MEDIA RECOVERY MARKER SCN:0x0000.00000000 SEQ:0 OP:5.19 ENC:0
session number = 7
serial number = 43
current username = B
login username = B
client info =
OS username = LENOVO-382E0EF1Owner
Machine name = MSHOMELENOVO-382E0EF1
OS terminal = LENOVO-382E0EF1
OS process id = 2360:4200
OS program name = sqlplus.exe
transaction name =
version 186646784
audit sessionid 5892380
Client Id =
--=============================
下面這個REDO RECORD是對第二條資料修改記錄的redo資訊,只有2個change,
第一個change是undo block的資訊,第二個是data block的資訊
--=============================
REDO RECORD - Thread:1 RBA: 0x000056.0000c742.0070 LEN: 0x010c VLD: 0x01
SCN: 0x0000.0080d6cf SUBSCN: 2 01/27/2013 12:42:17
CHANGE #1 TYP:0 CLS:40 AFN:5 DBA:0x014015fd OBJ:4294967295 SCN:0x0000.0080d6cf SEQ:1 OP:5.1 ENC:0 RBL:0
ktudb redo: siz: 112 spc: 3300 flg: 0x0022 seq: 0x06e0 rec: 0x22
xid: 0x000c.01e.00001620
ktubu redo: slt: 30 rci: 33 opc: 11.1 objn: 19949 objd: 19949 tsn: 4
Undo type: Regular undo Undo type: Last buffer split: No
Tablespace Undo: No
0x00000000
KDO undo record:
KTB Redo
op: 0x02 ver: 0x01
compat bit: 4 (post-11) padding: 0
op: C uba: 0x014015fd.06e0.21
KDO Op code: URP row dependencies Disabled
xtype: XA flags: 0x00000000 bdba: 0x01000cf3 hdba: 0x01000cf2
itli: 2 ispac: 0 maxfr: 4858
tabn: 0 slot: 1(0x1) flag: 0x2c lock: 0 ckix: 0
ncol: 2 nnew: 1 size: 0
col 1: [ 1] 62
CHANGE #2 TYP:0 CLS:1 AFN:4 DBA:0x01000cf3 OBJ:19949 SCN:0x0000.0080d6cf SEQ:1 OP:11.5 ENC:0 RBL:0
KTB Redo
op: 0x02 ver: 0x01
compat bit: 4 (post-11) padding: 0
op: C uba: 0x014015fd.06e0.22
KDO Op code: URP row dependencies Disabled
xtype: XA flags: 0x00000000 bdba: 0x01000cf3 hdba: 0x01000cf2
itli: 2 ispac: 0 maxfr: 4858
tabn: 0 slot: 1(0x1) flag: 0x2c lock: 2 ckix: 0
ncol: 2 nnew: 1 size: 0
col 1: [ 1] 65
--=============================
下面這個REDO RECORD是對第三條資料修改記錄的redo資訊,只有2個change,
第一個change是undo block的資訊,第二個是data block的資訊
--=============================
REDO RECORD - Thread:1 RBA: 0x000056.0000c742.017c LEN: 0x010c VLD: 0x01
SCN: 0x0000.0080d6cf SUBSCN: 3 01/27/2013 12:42:17
CHANGE #1 TYP:0 CLS:40 AFN:5 DBA:0x014015fd OBJ:4294967295 SCN:0x0000.0080d6cf SEQ:2 OP:5.1 ENC:0 RBL:0
ktudb redo: siz: 112 spc: 3186 flg: 0x0022 seq: 0x06e0 rec: 0x23
xid: 0x000c.01e.00001620
ktubu redo: slt: 30 rci: 34 opc: 11.1 objn: 19949 objd: 19949 tsn: 4
Undo type: Regular undo Undo type: Last buffer split: No
Tablespace Undo: No
0x00000000
KDO undo record:
KTB Redo
op: 0x02 ver: 0x01
compat bit: 4 (post-11) padding: 0
op: C uba: 0x014015fd.06e0.22
KDO Op code: URP row dependencies Disabled
xtype: XA flags: 0x00000000 bdba: 0x01000cf3 hdba: 0x01000cf2
itli: 2 ispac: 0 maxfr: 4858
tabn: 0 slot: 2(0x2) flag: 0x2c lock: 0 ckix: 0
ncol: 2 nnew: 1 size: 0
col 1: [ 1] 63
CHANGE #2 TYP:0 CLS:1 AFN:4 DBA:0x01000cf3 OBJ:19949 SCN:0x0000.0080d6cf SEQ:2 OP:11.5 ENC:0 RBL:0
KTB Redo
op: 0x02 ver: 0x01
compat bit: 4 (post-11) padding: 0
op: C uba: 0x014015fd.06e0.23
KDO Op code: URP row dependencies Disabled
xtype: XA flags: 0x00000000 bdba: 0x01000cf3 hdba: 0x01000cf2
itli: 2 ispac: 0 maxfr: 4858
tabn: 0 slot: 2(0x2) flag: 0x2c lock: 2 ckix: 0
ncol: 2 nnew: 1 size: 0
col 1: [ 1] 65
--================================
上面試驗我們能夠很清楚的知道修改一條資料oracle會產生一個REDO RECORD,那怕被
修改的資料是在同一個block上。一個REDO RECORD可能會包含若干個change vector,
這樣看來REDO RECORD是oarcle使用redo恢復時可用的最小單位了。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/19602/viewspace-1060161/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- zt_redo record 之change vector op操作碼含義
- oracle redo record scn與transaction相關block scn關係小記Oracle RedoBloC
- 關於Oracle的redo和undo的理解Oracle
- oracle的redo和undoOracle
- 從Undo, Redo, DataFile看Oracle中的事務過程Oracle
- 一個事務的整個流程,datafile,undo,redo的內容
- Oracle redo解析之-3、常見change分析Oracle Redo
- MySQL學習之change buffer 和 redo logMySql
- MySQL中redo log、undo log、binlog關係以及區別MySql
- 淺析MySQL事務中的redo與undoMySql
- DB2 的事務日誌(redo log)DB2
- mysql關於redo事務日誌ib_logfile的理解MySql
- Oracle的redo 和undo的區別Oracle
- 【REDO】Oracle redo undo 學習Oracle Redo
- Oracle技術嘉年華的一個案例,redo的那些事,連載一Oracle
- Oracle技術嘉年華的一個案例,redo的那些事,連載二Oracle
- Oracle技術嘉年華的一個案例,redo的那些事,連載三Oracle
- 《Undo, Redo, DataFile看Oracle中的事務過程》學習筆記Oracle筆記
- MySQL的Redo log 以及Bin logMySql
- 【REDO】Oracle redo內部結構Oracle Redo
- 【REDO】Oracle redo advice-sqlOracle RedoSQL
- Oracle DG管理Redo Transport服務Oracle
- oracle redo和undo系列一Oracle Redo
- Redo Log之一:理解Oracle redo logOracle Redo
- Oracle Redo and UndoOracle Redo
- 修改oracle redo log的大小Oracle Redo
- Oracle中的redo copy latchOracle
- MySQL之事務和redo日誌MySql
- 關於redo的幾個小知識點
- Oracle Dataguard Standby Redo Log的兩個實驗Oracle
- Oracle中undo 如何產生RedoOracle
- oracle丟失的是所有的redo日誌組Oracle
- MYSQL 是如何保證binlog 和redo log同時提交的?MySql
- redo和undo的區別
- Oracle redo解析之-1、oracle redo log結構計算Oracle Redo
- look-into-oracle-redoOracle
- Oracle REDO損壞Oracle Redo
- oracle redo log operationOracle Redo