Oracle 通过undo块查看事务信息(转)
Oracle 11.2.0.3 RAC
实验目的:
通过undo块查看Oracle事务信息
实验细节:
1 开始一个事务
SQL> select * from t1;
ID NAME
---------- ------------------------------
1 ycr
2 zhy
3 wya
5 lj
4 zhb
2 mk
2 cc
SQL> update t1 set id=6 where name='cc';
1 row updated.
此事务不要commit或者rollback。
2 查看事务信息
a)查看session号:
SQL> select sid from v$mystat where rownum=1;
SID
----------
27
b)获取undo槽位等信息:
SQL> select xidusn,xidslot,xidsqn from V$TRANSACTION t,v$session s where s.sid=27 and s.taddr=t.addr;
XIDUSN XIDSLOT XIDSQN
---------- ---------- ----------
10 26 1741
SQL> select sid,trunc(id1/65536) usn,mod(id1,65536) slot,id2 wrap,lmode from v$lock where type='TX' and sid='27';
SID USN SLOT WRAP LMODE
---------- ---------- ---------- ---------- ----------
27 10 26 1741 6
其中
Column Description
XIDUSN Undo segment number
XIDSLOT Slot number
XIDSQN Sequence number
3 根据查询到的信息找到undo块:
a)查看undo块头位置
SQL> clear columns
columns cleared
SQL> col name for a40
SQL> select * from v$rollname where usn=10;
USN NAME
---------- ----------------------------------------
10 _SYSSMU10_3271578125$
b)dump undo块
alter system dump undo header"_SYSSMU10_3271578125$";
select * from v$diag_info where name='Default Trace File';
/u01/app/oracle/diag/rdbms/irac/IRAC1/trace/IRAC1_ora_4444.trc
c)查看undo块头信息:
index state cflags wrap# uel scn dba parent-xid nub stmt_num cmt
------------------------------------------------------------------------------------------------
0x19 9 0x00 0x06d0 0x0012 0x0000.00b6ed00 0x00c00382 0x0000.000.00000000 0x00000001 0x00000000 1509426012
0x1a 10 0x80 0x06cd 0x0004 0x0000.00b6f712 0x00c00397 0x0000.000.00000000 0x00000001 0x00000000 0
0x1b 9 0x00 0x06ce 0x0002 0x0000.00b6ed4f 0x00c00397 0x0000.000.00000000 0x00000003 0x00000000 1509426012
可以看到找到了对应的事务
state为10说明为活动事务,warp#为0x06cd同v$lock查到的信息相同,换算成10进制为1741。
最新文章
- PHPExcel 使用笔记
- flash builder (fb) 与flash professional cs6(fla) 联合调试
- 在Linux上编写C#程序
- Solr学习笔记之3、Solr dataimport - 从SQLServer导入数据建立索引
- ACTIVITI 表结构数据分析
- 使用hql动态创建对象问题
- 使用Office Online Server在线预览Office
- mysql 开发进阶篇系列 33 工具篇(mysqlbinlog日志管理工具)
- 二、java三大特性--继承
- SQL注入之Sqli-labs系列第二十八关(过滤空格、注释符、union select)和第二十八A关
- vue使用animate.css库
- Rsync数据同步应用指南
- spyder快捷键
- MATLAB中 histogram 和 imhist 的区别
- Ubuntu 1804 本地显示远程服务器文件
- android多线程进度条
- html -- contenteditable 属性:指定元素内容是否可编辑
- 【51NOD-0】1106 质数检测
- 将织梦后台中的DATA改名称
- C#反射Assembly 详细说明,有项目例子