您的位置:首页 >> 数据库 >> Oracle >> 体系架构 >> 正文
体系架构 RSS
 

Undo Internal的研究

http://www.rdxx.com 05年12月06日 00:00 我要投稿

关键词: internal
 

  本文就Undo的内部结构作初步探讨:
  
  我们通过实验来看一下回滚段的内部结构.
  
  测试脚本及过程如下:
  
  首先创建一个测试表
  create table ud ( n number );
  insert into ud values(1);
  insert into ud values(2);
  commit;
  
  然后执行一个事物:
  select * from ud;
  update ud set n=1000 where n=2;
  select * from ud;
  
  找到该事物使用的回滚段:
  select xidusn,xidslot,xidsqn,ubablk,ubafil,ubarec from v$transaction;
  
  获得回滚段名称并dump其内容:
  select usn,name from v$rollname where usn=7;
  alter system dump undo header '_SYSSMU7$';
  
  以下开始测试:
  
  SQL> create table ud ( n number );
  Table created.
  
  SQL> insert into ud values(1);
  1 row created.
  
  SQL> insert into ud values(2);
  1 row created.
  
  SQL> commit;
  Commit complete.
  
  SQL> startup force;
  ORACLE instance started.
  
  Total System Global Area  47256168 bytes
  Fixed Size          451176 bytes
  Variable Size       29360128 bytes
  Database Buffers      16777216 bytes
  Redo Buffers         667648 bytes
  Database mounted.
  Database opened.
  SQL> select usn,writes,rssize,xacts,hwmsize,shrinks,wraps from v$rollstat;
  
      USN   WRITES   RSSIZE   XACTS  HWMSIZE  SHRINKS   WRAPS
  ---------- ---------- ---------- ---------- ---------- ---------- ----------
       0    7380   385024     0   385024     0     0
       1     0   122880     0   122880     0     0
       2     0   122880     0   122880     0     0
       3     0   122880     0   122880     0     0
       4     0   122880     0   122880     0     0
       5     0   122880     0   122880     0     0
       6     0   122880     0   122880     0     0
       7     0   122880     0   122880     0     0
       8     54   122880     0   122880     0     0
       9    9040   122880     0   122880     0     0
      10    210   122880     0   122880     0     0
  
  11 rows selected.
  
  SQL> select * from ud;
  
       N
  ----------
       1
       2
  
  SQL> update ud set n=1000 where n=2;
  
  1 row updated.
  
  SQL> select xidusn,xidslot,xidsqn,ubablk,ubafil,ubarec from v$transaction;
  
    XIDUSN  XIDSLOT   XIDSQN   UBABLK   UBAFIL   UBAREC
  ---------- ---------- ---------- ---------- ---------- ----------
       7     35    2861    109     2     28
  
  SQL> select usn,writes,rssize,xacts,hwmsize,shrinks,wraps from v$rollstat;
  
      USN   WRITES   RSSIZE   XACTS  HWMSIZE  SHRINKS   WRAPS
  ---------- ---------- ---------- ---------- ---------- ---------- ----------

共15页  第1页 第2页 第3页 第4页 第5页 第6页 第7页 第8页 第9页 第10页 第11页 第12页 第13页 第14页 第15页


 
 
标签: internal 打印本文
 
 
  热点搜索
 
 
 



Valid XHTML 1.0 Transitional
Copyright ©2005 - 2008 Rdxx.Com,All Rights Reserved
收藏本页
收藏本站