ORACLE事务流程

来源:互联网 发布:竞价算法代码 编辑:程序博客网 时间:2024/06/08 19:05

ORACLE事务流程

1.分配一个回滚段
2.在回滚段事务表中分配一个事务槽
3.分配undo block
4.更新数据块上的ITL事务槽
5.把前镜像记录在undo block内
6.更改数据块的内容

update 一条语句.会导致回滚段写入量增加.

通过 select xidusn,xidslot,xidsqn,ubablk,ubafil,ubarec from v$transaction 的数据变化

可以发现这一切.

通过 select xidusn,xidslot,xidsqn,ubablk,ubafil,ubarec from v$transaction 可以查看当前事务

的回滚段。并通过 select usn,name from v$rollname where usn= :usn

获得回滚段名称,并 alter system dump undo header ':name' 获得回滚段头的事务列表

index  state cflags  wrap#    uel         scn            dba            parent-xid    nub     stmt_num    cmt
  ------------------------------------------------------------------------------------------------
   0x2c    9    0x00  0x1ae5  0x002f  0x0000.106d1cbd  0x00804775  0x0000.000.00000000  0x00000001   0x00000000  1259981046
   0x2d   10    0x80  0x1add  0x0006  0x0000.10713a25  0x00804778  0x0000.000.00000000  0x00000001   0x00000000  0

 state 为 10表示是活动事务. 通过DBA地址得到回滚段所在文件,块号.

通过 alter system datafile :file block :block 可以查看回滚段信息,即前镜像信息.

alter system datafile :file block :block 得到数据块的的信息,查看查看数据块的变化,ITL信息