##从上面的输出可以看到8/16 Rec #0x19,8/17 Rec#0x1先后被覆盖,前者包含数据修改前的拷贝,后者包含了事务槽回滚所需的uba信息,这时必然导致下面session 2遇到ORA-01555错误
/////////////
//session 2:
/////////////
##久违的ORA-01555错误终于来了
select * from scott.tabnow1
*
ERROR at line 1:
ORA-01555: snapshot too old: rollback segment number 2 with name "_SYSSMU2$"
too small
alter system dump datafile 8 block min 9 block max 31;
##把所有undo block dump到文件stest2_ora_29753578.trc
alter system dump datafile 8 block min 9 block max 31;
##在trace文件中未能查到02000010.187e.19,意味着事务表不能回溯到足够旧的版本
cat stest2_ora_29753578.trc | grep 02000010.187e.19 | wc –l
0
##在8/16 #0x19中的记录也已经被覆盖掉了,意味着即使事务表即使能够顺利回滚,但也找不到修改前的数据拷贝了
*-----------------------------
* Rec #0x19 slt: 0x10 objn: 89731(0x00015e83) objd: 89731 tblspc: 8(0x00000008)
* Layer: 11 (Row) opc: 1 rci 0x00
Undo type: Regular undo Begin trans Last buffer split: No
Temp Object: No
Tablespace Undo: No
rdba: 0x00000000Ext idx: 0
flg2: 0
*-----------------------------
uba: 0x02000010.1881.18 ctl max scn: 0x0000.00ae9c40 prv tx scn: 0x0000.00ae9c43
txn start scn: scn: 0x0000.00ae9ca6 logon user: 0
prev brb: 33554463 prev bcl: 0
KDO undo record:
KTB Redo
op: 0x04 ver: 0x01
compat bit: 4 (post-11) padding: 1
op: L itl: xid: 0x0002.006.000011e8 uba: 0x02000010.1881.17
flg: C--- lkc: 0 scn: 0x0000.00ae9ca3
Array Update of 2 rows:
tabn: 0 slot: 0(0x0) flag: 0x2c lock: 0 ckix: 1
ncol: 1 nnew: 1 size: 0
KDO Op code: 21 row dependencies Disabled
xtype: XAxtype KDO_KDOM2 flags: 0x00000080 bdba: 0x010005be hdba: 0x010005ba
itli: 2 ispac: 0 maxfr: 4858
vect = 0
col 0: [ 2] c1 3b
tabn: 0 slot: 1(0x1) flag: 0x2c lock: 0 ckix: 1
ncol: 1 nnew: 1 size: 0
KDO Op code: 21 row dependencies Disabled
xtype: XAxtype KDO_KDOM2 flags: 0x00000080 bdba: 0x010005be hdba: 0x010005ba
itli: 2 ispac: 0 maxfr: 4858
vect = 0
col 0: [ 2] c1 3b
附proc1.sql:
///Proc1.sql///
set serveroutput on
declare
v_xidusn number;
v_xidslot number;
v_xidsqn number;
v_ubafil number;
v_ubablk number;
v_ubasqn number;
v_ubarec number;
v_cnt number:=0;
v_rownum number;
v_startscn varchar2(20);
v_rowid rowid;
begin
select to_char(timestamp_to_scn(sysdate),'xxxxxxxx') into v_startscn from dual;
dbms_output.put_line('START SCN:'||v_startscn);
for i in 1..340 loop
update scott.t1 set id = i;
select XIDUSN,XIDSLOT,XIDSQN,UBAFIL,UBABLK,UBAREC,UBASQN into v_xidusn,v_xidslot,v_xidsqn,v_ubafil,v_ubablk,v_ubarec,v_ubasqn from v$transaction;
v_cnt:=v_cnt+1;