- 浏览: 1000874 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (529)
- 服务器 (8)
- jsp (1)
- java (6)
- AIX (1)
- solaris (3)
- linux学习 (53)
- javaScript (2)
- hibernate (1)
- 数据库 (74)
- sql语句 (8)
- oracle 学习 (75)
- oracle 案例 (42)
- oracle 管理 (42)
- Oracle RAC (27)
- oracle data guard (12)
- oracle 参数讲解 (14)
- Oracle 字符集 (8)
- oracle性能调优 (24)
- oracle备份与恢复 (12)
- oracle Tablespace (9)
- oracle性能诊断艺术 (1)
- oracle 11g学习 (5)
- oracle streams (1)
- oracle upgrade and downgrade (4)
- db2学习 (13)
- db2命令学习 (2)
- mysql (28)
- sql server (30)
- sql server 2008 (0)
- 工具 (10)
- 操作系统 (3)
- c++ (1)
- stock (1)
- 生活 (5)
- HADOOP (2)
最新评论
-
massjcy:
...
如何将ubuntu文件夹中文名改为英文 -
skypiea:
谢谢。。。
终于解决了。。。
Oracle 10.2.0.4(5)EM不能启动的解决方案(Patch 8350262) -
qwe_rt:
引用vi /etc/sysconfig/network 请问 ...
Linux操作系统下配置静态IP上网 -
liuqiang:
sudo killall -9 apache2
ps 和 kill 命令详解 -
dazuiba:
引用*绝杀 kill -9 PID 当使用此命令时,一定要通过 ...
ps 和 kill 命令详解
接上一节的 oracle执行DML(事物过程)的深入研究(一)
如果要了解事务的等待现象,就需要了解事务发生时,在什么阶段、 对哪些数据、 变更为什么形式。 尤其需要了解数据块和撤销区域中的数据修改。若利用 Oracle 提供的转储功能,就能从物理角度上观察被事务所修改的数据信息。接下来通过一个简单的例子进行讨论。
我们实验如下:
1.修改数据如下:
SQL> update test set owner='HELLO' WHERE ROWNUM=1;
已更新 1 行。
SQL> SELECT rowid,dbms_rowid.rowid_relative_fno(rowid) as fno,dbms_rowid.rowid_block_number(rowid) a
s blkno from test where rownum=1;
ROWID FNO BLKNO
------------------ ---------- ----------
AAAMuBAAEAAAHMRAAp 4 29457
可以看到修改该的行数据在第4号文件第29457块上,我们dump其文件内容 SQL> alter system dump datafile 4 block 29457; 系统已更改。 Start dump data blocks tsn: 4 file#: 4 minblk 29457 maxblk 29457
通过块转储文件的内容,可确认如下事实: ( 1 ) ITL 上,已经执行修改的事务在 ITL 上以 itl=0x03 登记。当前状态是尚未提交的活动的状态, 因此正在获得 TX 锁。将 Xid=0x0006.00b.00000bc6变换为十 进制就 是USN=6 、 SLOT=11 、 SQN=3014 。从 V$TRANSACTION 视图上确认当前会话相应的信息, 可以发现是完全一致的。 SQL> select sid from v$mystat where rownum=1; ( 2 ) ITL 信息上 Lock=1 ,这代表被事务修改的行数。而且,因为尚未提交,所以 Flag 上没有设定任何值。与此相同, SCN 也未被分配。 Flag 值为 “ C ”或“ U ”时,就意味着已执行提交。
( 3 )利用 ITL 的 UBA ( Undo Block Address )信息,可以掌握当前事务最近使用的撤销块和撤销记录( Record )的位置。 UBA 由 [Undo Block DBA+Seq#+Record#] 组成,执行回滚时就要利用这些信息。 ( 4 ) block_row_dump 区域上的第一行的 lb 值被设定为 0x1 。 lb 是 Lock Byte 的缩写,表示当前行挂起锁的 ITL 编号。也就是说, 1 号 ITL 修改当前行。 Lock byte 值实际发生提交也不会被清除,最终发生 Delayed block cleanout 或因另外进程修改块时才会被清除。 事务和撤销块转储 在上面例子中, 若能转储已修改数据块的事务所使用的回滚段( USN=6 )的头块( header block ), 就可以确认事务相应信息是怎样被管理的。 SQL> select xidusn,xidslot,xidsqn from v$transaction where addr=(select taddr from v$session where s
dump 2号文件89号数据块内容 系统已更改。 *** 2010-12-14 14:14:11.171 0x0b 10 0x80 0x0bc6 0x0000 0x0000.0045b96e 0x0080005a 0x0000.000.00000000 0x00000001 0x00000000 0 0x0c 9 0x00 0x0bc5 0x0029 0x0000.0045b55c 0x00800045 0x0000.000.00000000 0x00000001 0x00000000 1292303295 然后我们执行commit操作。 SQL> commit; 提交完成。 从新dump 数据块内容。 系统已更改。 Start dump data blocks tsn: 4 file#: 4 minblk 29457 maxblk 29457 tab 0, row 41, @0x37f dump undo数据块的内容 系统已更改。 Start dump data blocks tsn: 1 file#: 2 minblk 89 maxblk 89
Extent Control Header
buffer tsn: 4 rdba: 0x01007311 (4/29457)
scn: 0x0000.0045b9bb seq: 0x01 flg: 0x00 tail: 0xb9bb0601
frmt: 0x02 chkval: 0x0000 type: 0x06=trans data
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x07AB2200 to 0x07AB4200
...
Block header dump: 0x01007311
Object id on Block? Y
seg/obj: 0xcb81 csc: 0x00.1223d9 itc: 3 flg: E typ: 1 - DATA
brn: 0 bdba: 0x1007309 ver: 0x01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.026.0000023a 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x02 0x0001.00d.00000396 0x0080072c.0119.07 --U- 41 fsc 0x1027.001226bd
0x03 0x0006.00b.00000bc6 0x0080005a.04c8.17 ---- 1 fsc 0x0001.00000000
data_block_dump,data header at 0x7ab227c
===============
tsiz: 0x1f80
hsiz: 0x9e
pbl: 0x07ab227c
bdba: 0x01007311
76543210
flag=--------
ntab=1
nrow=70
frre=-1
fsbo=0x9e
fseo=0x37f
avsp=0x341
tosp=0x13bb
0xe:pti[0] nrow=70 offs=0
...
tab 0, row 41, @0x37f
tl: 96 fb: --H-FL-- lb: 0x3 cc: 13
col 0: [ 5] 48 45 4c 4c 4f
col 1: [23]
2f 33 64 37 30 62 62 33 36 5f 50 6f 6c 69 63 79 43 68 65 63 6b 65 72
col 2: *NULL*
col 3: [ 4] c3 02 04 54
col 4: *NULL*
col 5: [ 7] 53 59 4e 4f 4e 59 4d
col 6: [ 7] 78 69 08 1e 0f 11 05
col 7: [ 7] 78 69 08 1e 0f 11 05
col 8: [19] 32 30 30 35 2d 30 38 2d 33 30 3a 31 34 3a 31 36 3a 30 34
col 9: [ 5] 56 41 4c 49 44
col 10: [ 1] 4e
col 11: [ 1] 4e
col 12: [ 1] 4e
tab 0, row 42, @0xe44
tl: 98 fb: --H-FL-- lb: 0x0 cc: 13
col 0: [ 3] 53 59 53
col 1: [24]
2f 37 36 38 65 65 38 61 30 5f 50 6f 6c 69 63 79 4e 6f 64 65 49 6d 70 6c
col 2: *NULL*
col 3: [ 4] c3 02 04 55
col 4: *NULL*
col 5: [10] 4a 41 56 41 20 43 4c 41 53 53
col 6: [ 7] 78 69 08 1e 0f 11 05
col 7: [ 7] 78 69 08 1e 0f 11 05
col 8: [19] 32 30 30 35 2d 30 38 2d 33 30 3a 31 34 3a 31 36 3a 30 34
col 9: [ 5] 56 41 4c 49 44
col 10: [ 1] 4e
col 11: [ 1] 4e
col 12: [ 1] 4e
...
end_of_block_dump
End dump data blocks tsn: 4 file#: 4 minblk 29457 maxblk 29457
SID
----------
137
SQL> select xidusn,xidslot,xidsqn from v$transaction where addr=(select taddr from v$session where s id=137);
XIDUSN XIDSLOT XIDSQN
---------- ---------- ----------
6 11 3014 XID=USN + SLOT + SQN
id=137);
XIDUSN XIDSLOT XIDSQN
---------- ---------- ----------
6 11 3014 USN=6,Slot=11
SQL> select file_id,block_id from dba_rollback_segs where segment_id=6;
FILE_ID BLOCK_ID
---------- ----------
2 89
SQL> alter system dump datafile 2 block 89;
Start dump data blocks tsn: 1 file#: 2 minblk 89 maxblk 89
buffer tsn: 1 rdba: 0x00800059 (2/89)
scn: 0x0000.0045b9bb seq: 0x01 flg: 0x04 tail: 0xb9bb2601
frmt: 0x02 chkval: 0x8562 type: 0x26=KTU SMU HEADER BLOCK
...
Extent Control Header
-----------------------------------------------------------------
Extent Header:: spare1: 0 spare2: 0 #extents: 3 #blocks: 23
last map 0x00000000 #maps: 0 offset: 4080
Highwater:: 0x0080005a ext#: 0 blk#: 0 ext size: 7
#blocks in seg. hdr's freelists: 0
#blocks below: 0
mapblk 0x00000000 offset: 0
Unlocked
Map Header:: next 0x00000000 #extents: 3 obj#: 0 flag: 0x40000000
Extent Map
-----------------------------------------------------------------
0x0080005a length: 7
0x00800121 length: 8
0x00800041 length: 8
Retention Table 和flashback 功能 相关
-----------------------------------------------------------
Extent Number:0 Commit Time: 1292304533
Extent Number:1 Commit Time: 1292302823
Extent Number:2 Commit Time: 1292304533
TRN CTL:: seq: 0x04c8 chd: 0x0009 ctl: 0x0023 inc: 0x00000000 nfb: 0x0000
mgc: 0x8201 xts: 0x0068 flg: 0x0001 opt: 2147483646 (0x7ffffffe)
uba: 0x0080005a.04c8.17 scn: 0x0000.0045b3cc
Version: 0x01
FREE BLOCK POOL::
uba: 0x00000000.04c8.16 ext: 0x0 spc: 0x157e
uba: 0x00000000.04c8.03 ext: 0x0 spc: 0x1eb8
uba: 0x00000000.04bc.14 ext: 0x2 spc: 0x5c2
uba: 0x00000000.0473.20 ext: 0x1 spc: 0x1012
uba: 0x00000000.0000.00 ext: 0x0 spc: 0x0
TRN TBL:: 事物表
index state cflags wrap# uel scn dba parent-xid nub stmt_num cmt
------------------------------------------------------------------------------------------------
...
0x0a 9 0x00 0x0bc7 0x001a 0x0000.0045b492 0x00800045 0x0000.000.00000000 0x00000001 0x00000000 1292303166
...
End dump data blocks tsn: 1 file#: 2 minblk 89 maxblk 89
SQL> alter system dump datafile 4 block 29457;
buffer tsn: 4 rdba: 0x01007311 (4/29457)
scn: 0x0000.0045c06a seq: 0x01 flg: 0x02 tail: 0xc06a0601
frmt: 0x02 chkval: 0x0000 type: 0x06=trans data
...
Block header dump: 0x01007311
Object id on Block? Y
seg/obj: 0xcb81 csc: 0x00.1223d9 itc: 3 flg: E typ: 1 - DATA
brn: 0 bdba: 0x1007309 ver: 0x01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000a.026.0000023a 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x02 0x0001.00d.00000396 0x0080072c.0119.07 --U- 41 fsc 0x1027.001226bd
0x03 0x0006.00b.00000bc6 0x0080005a.04c8.17 --U- 1 fsc 0x0001.0045c06a -FLAG 变为 U(upper bound commit)提交状态
data_block_dump,data header at 0x7ab227c
===============
tsiz: 0x1f80
hsiz: 0x9e
pbl: 0x07ab227c
bdba: 0x01007311
76543210
flag=--------
ntab=1
nrow=70
frre=-1
fsbo=0x9e
fseo=0x37f
avsp=0x341
tosp=0x13bb
tl: 96 fb: --H-FL-- lb: 0x3 cc: 13
col 0: [ 5] 48 45 4c 4c 4f
col 1: [23]
2f 33 64 37 30 62 62 33 36 5f 50 6f 6c 69 63 79 43 68 65 63 6b 65 72
col 2: *NULL*
col 3: [ 4] c3 02 04 54
col 4: *NULL*
col 5: [ 7] 53 59 4e 4f 4e 59 4d
col 6: [ 7] 78 69 08 1e 0f 11 05
col 7: [ 7] 78 69 08 1e 0f 11 05
col 8: [19] 32 30 30 35 2d 30 38 2d 33 30 3a 31 34 3a 31 36 3a 30 34
col 9: [ 5] 56 41 4c 49 44
col 10: [ 1] 4e
col 11: [ 1] 4e
col 12: [ 1] 4e
tab 0, row 42, @0xe44
tl: 98 fb: --H-FL-- lb: 0x0 cc: 13
col 0: [ 3] 53 59 53
col 1: [24]
2f 37 36 38 65 65 38 61 30 5f 50 6f 6c 69 63 79 4e 6f 64 65 49 6d 70 6c
col 2: *NULL*
col 3: [ 4] c3 02 04 55
col 4: *NULL*
col 5: [10] 4a 41 56 41 20 43 4c 41 53 53
col 6: [ 7] 78 69 08 1e 0f 11 05
col 7: [ 7] 78 69 08 1e 0f 11 05
col 8: [19] 32 30 30 35 2d 30 38 2d 33 30 3a 31 34 3a 31 36 3a 30 34
col 9: [ 5] 56 41 4c 49 44
col 10: [ 1] 4e
col 11: [ 1] 4e
col 12: [ 1] 4e
end_of_block_dump
End dump data blocks tsn: 4 file#: 4 minblk 29457 maxblk 29457
SQL> alter system dump datafile 2 block 89;
buffer tsn: 1 rdba: 0x00800059 (2/89)
scn: 0x0000.0045c156 seq: 0x02 flg: 0x00 tail: 0xc1562602
frmt: 0x02 chkval: 0x0000 type: 0x26=KTU SMU HEADER BLOCK
-----------------------------------------------------------------
Extent Header:: spare1: 0 spare2: 0 #extents: 3 #blocks: 23
last map 0x00000000 #maps: 0 offset: 4080
Highwater:: 0x0080005b ext#: 0 blk#: 1 ext size: 7
#blocks in seg. hdr's freelists: 0
#blocks below: 0
mapblk 0x00000000 offset: 0
Unlocked
Map Header:: next 0x00000000 #extents: 3 obj#: 0 flag: 0x40000000
Extent Map
-----------------------------------------------------------------
0x0080005a length: 7
0x00800121 length: 8
0x00800041 length: 8
Retention Table
-----------------------------------------------------------
Extent Number:0 Commit Time: 1292304533
Extent Number:1 Commit Time: 1292302823
Extent Number:2 Commit Time: 1292304533
TRN CTL:: seq: 0x04c8 chd: 0x000a ctl: 0x0011 inc: 0x00000000 nfb: 0x0001
mgc: 0x8201 xts: 0x0068 flg: 0x0001 opt: 2147483646 (0x7ffffffe)
uba: 0x0080005b.04c8.0d scn: 0x0000.0045b480
Version: 0x01
FREE BLOCK POOL::
uba: 0x0080005b.04c8.0e ext: 0x0 spc: 0x18d2
uba: 0x00000000.04c8.03 ext: 0x0 spc: 0x1eb8
uba: 0x00000000.04bc.14 ext: 0x2 spc: 0x5c2
uba: 0x00000000.0473.20 ext: 0x1 spc: 0x1012
uba: 0x00000000.0000.00 ext: 0x0 spc: 0x0
TRN TBL::
index state cflags wrap# uel scn dba parent-xid nub stmt_num cmt
------------------------------------------------------------------------------------------------
0x0b 9 0x00 0x0bc6 0x0009 0x0000.0045c06a 0x0080005a 0x0000.000.00000000 0x00000001 0x00000000 1292307799
End dump data blocks tsn: 1 file#: 2 minblk 89 maxblk 89
发表评论
-
sqlldr总结参数介绍
2012-06-28 14:29 22706有效的关键字: userid -- ORACLE use ... -
11gR2新特性:STANDBY_MAX_DATA_DELAY
2011-12-27 11:18 1157Active Data Guard 是 Oracle 11g ... -
Linux下用OCCI或OCI连接Oracle
2011-07-26 12:00 2865首先,去oracle官网下载C ... -
Oracle Mutex实现机制
2011-05-18 23:43 1032我们都知道Latch是Oracle ... -
local_listener参数作用
2011-05-10 17:19 1869pmon只会动态注册port等于1521的监听,否则 ... -
oracle伪列 rowid和rownum
2011-03-23 10:00 3491整理ROWID一 一,什么是伪列RowID?1,首先是一种数 ... -
Oracle10gR2 主备自动切换之客户端Failover配置
2011-01-20 10:32 9221. 主库检查和设置假设新增的服务名为ORCL_TAF.LK. ... -
Oracle10g配置Dataguard的相关参数解释
2011-01-20 10:24 1224参考自 http://space.itpub.ne ... -
wrap加密oracle包
2011-01-19 11:52 1267大家都知道oracle的很多系统包是没法看它的源码的,orac ... -
利用hcheck检查数据字典一致性状态
2011-01-17 17:42 1763利用hcheck可以检查oracle数据字典的一致性状态,主要 ... -
插入相同的数据量普通表和临时表产生的redo对比
2011-01-17 16:08 953往临时表里插入相同量 ... -
Database Link与GLOBAL_NAMES参数
2011-01-12 13:36 1002当GLOBAL_NAMES参数设置为TRUE时,使用DATAB ... -
Oracle Streams学习二(清除流配置)
2011-01-09 23:34 1147在完成streams部署之后,如果需要重新配置或舍弃配置,可以 ... -
red hat enterprise 下完全删除oracle 数据库
2011-01-05 01:28 1721步骤 1 以oracle用户登录主、备节点。步骤 2 ... -
Oracle常用dump命令
2010-12-20 00:31 793Oracle常用dump命令,记录一下备查。 一.M ... -
oracle执行DML(事物过程)的深入研究(一)
2010-12-14 10:26 2771用户所执行 DML (即执行事务)操作在 Oracle 内部按 ... -
Oracle基本数据类型存储格式研究(二)—数字类型
2010-12-14 00:35 1436数字类型包含number,intege ... -
Oracle基本数据类型存储格式研究(一)—字符类型
2010-12-13 23:32 11371.char char是定长字符型,内部代码是:96,最多可 ... -
关于oracle rowid的一些内容 -- 转载
2010-12-13 15:47 746本文讨论的是关于oracle ... -
oracle 进制转换
2010-12-13 14:24 12191.16进制转换为10进制 ...
相关推荐
文档说明:GoldenGate19.1 Oracle单向dml配置全过程,源端说19c数据库,asm磁盘组,目标端是 11g,本地文件系统。 作者:鼎甲科技 姚远
关于Oracle DDL,DML,DCL,TCL 的一些基础概念,对于初学者很有帮助
oracle操作数据-DML语句.pptx
Oracle DML触发器的执行顺序.pdf
oracleDML触发器.ppt
第6章 Oracle_DML_高级查询.pptx
Oracle OLAP DML Reference 11g Release 2 (11.2)-1640
oracleDML触发器1.ppt
oracleDML触发器.pptx
在Oracle数据库中,如何查找,定位一张表最后一次的DML操作的时间呢? 方式有三种,不过都有一些局限性,下面简单的解析、总结一下。 1:使用ORA_ROWSCN伪列获取表最后的DML时间 ORA_ROWSCN伪列是Oracle 10g开始...
DML语句,包括插入、删除、修改、检索,是数据库操作中使用最多的SQL语句。 在数据库维护、管理、查询的时候,经常会遇到一次向DBMS提交多条SQL语句(DML语句)的情况。遗憾的是,绝大多数的DBMS...更多>> DML语句,包括...
oracle操作数据DML语句.ppt
oracle-function-执行动态sql(包括DML、DLL、DQL、DCL)
在oracle11g中DML语句对索引的影响[定义].pdf
介绍可以在SELECT语句中调用DML函数的一个例子
数据操作语言语句(Data manipulation language,DML)用于进行数据的检索和更新操作。其 中,数据检索操作使用SELECT 语句实现,是数据库应用中使用频率最高的操作类型,前文中已 做详细讲解,本章专门介绍其它的 ...