eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« 升级MT到3.1.6版本 | Blog首页 | Oracle中大批量删除数据的方法 »

Control SCN of Undo Segments
modb.pro

在回滚段头有一个重要的数据结构称为:Control SCN.
这个SCN是最近一个被重用的事务槽的SCN(重用是按事务的先后顺序重用的)。如果Control SCN比查询的Snapshot SCN新,那么Oracle不会试图去构造前镜像,而是马上返回ORA-01555错误,因为这个UNDO信息肯定已经被覆盖了。
这个Control SCN也会被用于delayed logging cleanout的提交SCN(仅当历史事务的UNDO信息已经被覆盖),在ITL中这个SCN被标记为U,代表"upper bound commit".
我们来看一下这个数据结构:
SQL> create table ud ( n number );

Table created

SQL> insert into ud values(1);

1 row inserted

SQL> insert into ud values(2);

1 row inserted

SQL> commit;

Commit complete

SQL> 
SQL> select * from ud;

         N
----------
         1
         2

SQL> update ud set n=1000 where n=2;

1 row updated

SQL> select * from ud;

         N
----------
         1
      1000

SQL> select xidusn,xidslot,xidsqn,ubablk,ubafil,ubarec from v$transaction;

    XIDUSN    XIDSLOT     XIDSQN     UBABLK     UBAFIL     UBAREC
---------- ---------- ---------- ---------- ---------- ----------
         2         30      11407        251          2         10

SQL> select usn,name from v$rollname where usn=2;

       USN NAME
---------- ------------------------------
         2 _SYSSMU2$

SQL> alter system dump undo header '_SYSSMU2$';

System altered

检查trace文件(摘录):
  TRN CTL:: seq: 0x02cd chd: 0x002e ctl: 0x0018 inc: 0x00000000 nfb: 0x0000
            mgc: 0x8201 xts: 0x0068 flg: 0x0001 opt: 2147483646 (0x7ffffffe)
            uba: 0x008000fb.02cd.0a scn: 0x0000.0e21169a
这里TRN CTL部分的scn就是前面我们所说的Contrl SCN.
参考:
http://www.ixora.com.au/q+a/cr.htm

历史上的今天...
    >> 2020-04-21文章:
    >> 2012-04-21文章:
    >> 2011-04-21文章:
    >> 2010-04-21文章:
    >> 2009-04-21文章:
    >> 2008-04-21文章:
           Resin、Apache、PHP与404错误
           美丽的京剧 美丽的晋剧
    >> 2007-04-21文章:
           在Oracle University大学演讲
    >> 2006-04-21文章:
           李白手书真迹-上阳台

By eygle on 2005-04-21 13:57 | Comments (1) | Internal | 264 |

1 Comment

据说 undo header会发生一致读,来获得control scn;那么这个 TRN CTL 结构 应该没有这么简单。


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com