<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>惜分飞 &#187; bbed修改itl</title>
	<atom:link href="https://www.xifenfei.com/tag/bbed%e4%bf%ae%e6%94%b9itl/feed" rel="self" type="application/rss+xml" />
	<link>https://www.xifenfei.com</link>
	<description>提供7*24专业数据库(Oracle,SQL Server,MySQL,PostgreSQL等)恢复和技术支持@Tel:17813235971</description>
	<lastBuildDate>Thu, 29 Oct 2026 15:31:46 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>bbed模拟提交事务一之修改itl</title>
		<link>https://www.xifenfei.com/2013/03/bbed%e6%a8%a1%e6%8b%9f%e6%8f%90%e4%ba%a4%e4%ba%8b%e5%8a%a1%e4%b8%80%e4%b9%8b%e4%bf%ae%e6%94%b9itl.html</link>
		<comments>https://www.xifenfei.com/2013/03/bbed%e6%a8%a1%e6%8b%9f%e6%8f%90%e4%ba%a4%e4%ba%8b%e5%8a%a1%e4%b8%80%e4%b9%8b%e4%bf%ae%e6%94%b9itl.html#comments</comments>
		<pubDate>Mon, 11 Mar 2013 13:54:46 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[bbed]]></category>
		<category><![CDATA[bbed修改itl]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=4187</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2013/03/bbed%e6%a8%a1%e6%8b%9f%e6%8f%90%e4%ba%a4%e4%ba%8b%e5%8a%a1%e4%b8%80%e4%b9%8b%e4%bf%ae%e6%94%b9itl.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div id="xifenfeicopyright">
<p>联系：<a href="https://www.xifenfei.com/about_xifenfei" target="_blank">手机/微信(+86 17813235971)   QQ(107644445)</a><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&#038;uin=107644445&#038;site=qq&#038;menu=yes"><img src="https://www.xifenfei.com/wp-content/themes/img/site_qq.jpg" alt="QQ咨询惜分飞" title="QQ咨询惜分飞"/></a></p>
<p>标题：<a href="https://www.xifenfei.com/2013/03/bbed%e6%a8%a1%e6%8b%9f%e6%8f%90%e4%ba%a4%e4%ba%8b%e5%8a%a1%e4%b8%80%e4%b9%8b%e4%bf%ae%e6%94%b9itl.html" target="_blank">bbed模拟提交事务一之修改itl</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>我们都知道，根据oracle 事务的一致性,当我们在session 1中进行dml操作,如果未提交在其他会话中是无法看到修改后的值(只能看到修改前的值).这里通过bbed模拟部分提交事务从而实现在其他会话中查看到另外会话未提交事务(本质已经部分模拟提交,还有undo segment header中信息未清理,下篇补充)<br />
<strong>create table(session 1)</strong></p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; create table chf.t_xifenfei
  2  as
  3  select object_id,object_name from dba_objects where rownum&lt;20;

Table created.

SQL&gt; select rowid,
  2  dbms_rowid.rowid_relative_fno(rowid) rel_fno,
  3  dbms_rowid.rowid_block_number(rowid) block_no
  4  from chf.t_xifenfei;

ROWID                 REL_FNO   BLOCK_NO
------------------ ---------- ----------
AAANL3AAEAAAAAcAAA          4         28
AAANL3AAEAAAAAcAAB          4         28
AAANL3AAEAAAAAcAAC          4         28
AAANL3AAEAAAAAcAAD          4         28
AAANL3AAEAAAAAcAAE          4         28
AAANL3AAEAAAAAcAAF          4         28
AAANL3AAEAAAAAcAAG          4         28
AAANL3AAEAAAAAcAAH          4         28
AAANL3AAEAAAAAcAAI          4         28
AAANL3AAEAAAAAcAAJ          4         28
AAANL3AAEAAAAAcAAK          4         28
AAANL3AAEAAAAAcAAL          4         28
AAANL3AAEAAAAAcAAM          4         28
AAANL3AAEAAAAAcAAN          4         28
AAANL3AAEAAAAAcAAO          4         28
AAANL3AAEAAAAAcAAP          4         28
AAANL3AAEAAAAAcAAQ          4         28
AAANL3AAEAAAAAcAAR          4         28
AAANL3AAEAAAAAcAAS          4         28

19 rows selected.

SQL&gt;  select * from chf.t_xifenfei;

 OBJECT_ID OBJECT_NAME
---------- --------------------
        20 ICOL$
        44 I_USER1
        28 CON$
        15 UNDO$
        29 C_COBJ#
         3 I_OBJ#
        25 PROXY_ROLE_DATA$
        39 I_IND1
        51 I_CDEF2
        26 I_PROXY_ROLE_DATA$_1
        17 FILE$
        13 UET$
         9 I_FILE#_BLOCK#
        41 I_FILE1
        48 I_CON1
        38 I_OBJ3
         7 I_TS#
        53 I_CDEF4
        19 IND$

19 rows selected.
</pre>
<p><strong>dump block(session 2)</strong></p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; alter system checkpoint;

System altered.

SQL&gt; alter system dump datafile 4 block 28;

System altered.

 
 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0xffff.000.00000000  0x00000000.0000.00  C---    0  scn 0x0b2c.c02d1987
0x02   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0x03   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
</pre>
<p><strong>update record(session 1)</strong></p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; update chf.t_xifenfei set object_name ='www.xifenfei.com' where rownum&lt;15;

14 rows updated.

SQL&gt; col object_name for a20
SQL&gt; select * from chf.t_xifenfei;

 OBJECT_ID OBJECT_NAME
---------- --------------------
        20 www.xifenfei.com
        44 www.xifenfei.com
        28 www.xifenfei.com
        15 www.xifenfei.com
        29 www.xifenfei.com
         3 www.xifenfei.com
        25 www.xifenfei.com
        39 www.xifenfei.com
        51 www.xifenfei.com
        26 www.xifenfei.com
        17 www.xifenfei.com
        13 www.xifenfei.com
         9 www.xifenfei.com
        41 www.xifenfei.com
        48 I_CON1
        38 I_OBJ3
         7 I_TS#
        53 I_CDEF4
        19 IND$

19 rows selected.
</pre>
<p><strong>dump block(session 2)</strong></p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; alter system checkpoint;

System altered.

--注意flush buffer_cache(不然后面bbed修改会被不能通过select显示,而且会被覆盖)
SQL&gt; alter system flush buffer_cache;

System altered.

SQL&gt;  alter system flush shared_pool;

System altered.

SQL&gt; alter system dump datafile 4 block 28;

System altered.

 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0xffff.000.00000000  0x00000000.0000.00  C---    0  scn 0x0b2c.c02d1987
0x02   0x000a.00a.0000017e  0x0081ffc7.01a2.22  ----   14  fsc 0x0000.00000000  &lt;--注意Lck 14
0x03   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
</pre>
<p><strong>bbed commit Transaction(session 3)</strong></p>
<pre class="brush: bash; title: ; notranslate">
BBED&gt; p ktbbh
struct ktbbh, 96 bytes                      @20      
   ub1 ktbbhtyp                             @20       0x01 (KDDBTDATA)
   union ktbbhsid, 4 bytes                  @24      
      ub4 ktbbhsg1                          @24       0x0000d2f7
      ub4 ktbbhod1                          @24       0x0000d2f7
   struct ktbbhcsc, 8 bytes                 @28      
      ub4 kscnbas                           @28       0xc02d1aec
      ub2 kscnwrp                           @32       0x0b2c
   b2 ktbbhict                              @36       3
   ub1 ktbbhflg                             @38       0x32 (NONE)
   ub1 ktbbhfsl                             @39       0x00
   ub4 ktbbhfnx                             @40       0x01000019
   struct ktbbhitl[0], 24 bytes             @44      
      struct ktbitxid, 8 bytes              @44      
         ub2 kxidusn                        @44       0xffff
         ub2 kxidslt                        @46       0x0000
         ub4 kxidsqn                        @48       0x00000000
      struct ktbituba, 8 bytes              @52      
         ub4 kubadba                        @52       0x00000000
         ub2 kubaseq                        @56       0x0000
         ub1 kubarec                        @58       0x00
      ub2 ktbitflg                          @60       0x8000 (KTBFCOM)
      union _ktbitun, 2 bytes               @62      
         b2 _ktbitfsc                       @62       2860
         ub2 _ktbitwrp                      @62       0x0b2c
      ub4 ktbitbas                          @64       0xc02d1987
   struct ktbbhitl[1], 24 bytes             @68      
      struct ktbitxid, 8 bytes              @68      
         ub2 kxidusn                        @68       0x000a
         ub2 kxidslt                        @70       0x000a
         ub4 kxidsqn                        @72       0x0000017e
      struct ktbituba, 8 bytes              @76      
         ub4 kubadba                        @76       0x0081ffc7
         ub2 kubaseq                        @80       0x01a2
         ub1 kubarec                        @82       0x22
      ub2 ktbitflg                          @84       0x000e (NONE) &lt;--修改要改为8000
      union _ktbitun, 2 bytes               @86      
         b2 _ktbitfsc                       @86       0
         ub2 _ktbitwrp                      @86       0x0000
      ub4 ktbitbas                          @88       0x00000000
   struct ktbbhitl[2], 24 bytes             @92      
      struct ktbitxid, 8 bytes              @92      
         ub2 kxidusn                        @92       0x0000
         ub2 kxidslt                        @94       0x0000
         ub4 kxidsqn                        @96       0x00000000
      struct ktbituba, 8 bytes              @100     
         ub4 kubadba                        @100      0x00000000
         ub2 kubaseq                        @104      0x0000
         ub1 kubarec                        @106      0x00
      ub2 ktbitflg                          @108      0x0000 (NONE)
      union _ktbitun, 2 bytes               @110     
         b2 _ktbitfsc                       @110      0
         ub2 _ktbitwrp                      @110      0x0000
      ub4 ktbitbas                          @112      0x00000000

BBED&gt; m /x 0080 offset 84
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
 File: /u01/oracle/oradata/XFF/users01.dbf (0)
 Block: 28               Offsets:   84 to  115           Dba:0x00000000
------------------------------------------------------------------------
 00800000 00000000 00000000 00000000  

 &lt;32 bytes per line&gt;

BBED&gt; sum apply
Check value for File 0, Block 28:
current = 0x03dc, required = 0x03dc


BBED&gt; p ktbbh
struct ktbbh, 96 bytes                      @20      
  …………
   struct ktbbhitl[1], 24 bytes             @68      
      struct ktbitxid, 8 bytes              @68      
         ub2 kxidusn                        @68       0x000a
         ub2 kxidslt                        @70       0x000a
         ub4 kxidsqn                        @72       0x0000017e
      struct ktbituba, 8 bytes              @76      
         ub4 kubadba                        @76       0x0081ffc7
         ub2 kubaseq                        @80       0x01a2
         ub1 kubarec                        @82       0x22
      ub2 ktbitflg                          @84       0x8000 (KTBFCOM) &lt;--修改值
      union _ktbitun, 2 bytes               @86      
         b2 _ktbitfsc                       @86       0
         ub2 _ktbitwrp                      @86       0x0000
      ub4 ktbitbas                          @88       0x00000000
  …………
</pre>
<p><strong>dump block(session 2)</strong></p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; alter system dump datafile 4 block 28;

System altered.

 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0xffff.000.00000000  0x00000000.0000.00  C---    0  scn 0x0b2c.c02d1987
0x02   0x000a.00a.0000017e  0x0081ffc7.01a2.22  C---    0  scn 0x0000.00000000
0x03   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
</pre>
<p><strong>select data(session 4)</strong></p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; select object_id,object_name from chf.t_xifenfei;

 OBJECT_ID OBJECT_NAME
---------- --------------------
        20 www.xifenfei.com
        44 www.xifenfei.com
        28 www.xifenfei.com
        15 www.xifenfei.com
        29 www.xifenfei.com
         3 www.xifenfei.com
        25 www.xifenfei.com
        39 www.xifenfei.com
        51 www.xifenfei.com
        26 www.xifenfei.com
        17 www.xifenfei.com
        13 www.xifenfei.com
         9 www.xifenfei.com
        41 www.xifenfei.com
        48 I_CON1
        38 I_OBJ3
         7 I_TS#
        53 I_CDEF4
        19 IND$

19 rows selected.
</pre>
<p>这里可以看到,已经模拟出来在其他session中可以访问数据库为commit的记录(在该block级别已经模拟了commit)</p>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2013/04/%e6%a8%a1%e6%8b%9fenq-tx-allocate-itl-entry%e7%ad%89%e5%be%85.html" rel="bookmark" class="crp_title">模拟enq: TX &#8211; allocate ITL entry等待</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2013/03/bbed%e6%a8%a1%e6%8b%9f%e6%8f%90%e4%ba%a4%e4%ba%8b%e5%8a%a1%e4%ba%8c%e4%b9%8b%e5%b1%8f%e8%94%bdsmon%e5%9b%9e%e6%bb%9a%e4%ba%8b%e5%8a%a1.html" rel="bookmark" class="crp_title">bbed模拟提交事务二之屏蔽smon回滚事务</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/08/%e9%87%8d%e7%8e%b0ora-6004000%e5%bc%82%e5%b8%b8.html" rel="bookmark" class="crp_title">重现ORA-600 4000异常</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/09/ora-00600-ktbdchk1-bad-dscn-%e8%a7%a3%e5%86%b3.html" rel="bookmark" class="crp_title">ORA-00600 [ktbdchk1: bad dscn] 解决</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/08/%e9%80%9a%e8%bf%87bbed%e8%a7%a3%e5%86%b3ora-006004000%e6%a1%88%e4%be%8b.html" rel="bookmark" class="crp_title">通过bbed解决ORA-00600[4000]案例</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/08/%e5%88%a9%e7%94%a8bbed%e6%89%be%e5%9b%9ebbed%e6%9b%b4%e6%96%b0%e5%89%8d%e5%80%bc.html" rel="bookmark" class="crp_title">利用bbed找回ORACLE更新前值</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2014/09/bbed%e7%ae%80%e5%8d%95%e6%9b%bf%e6%8d%a2block%e6%b5%8b%e8%af%95.html" rel="bookmark" class="crp_title">bbed简单替换block测试</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2019/02/oracle-19c-bbed.html" rel="bookmark" class="crp_title">Oracle 19C 依旧支持bbed</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2024/07/oracle-23ai-bbed.html" rel="bookmark" class="crp_title">Oracle 23ai依旧支持bbed</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/05/%e4%bd%bf%e7%94%a8bbed%e4%bf%ae%e5%a4%8d%e6%8d%9f%e5%9d%8fdatafile-header.html" rel="bookmark" class="crp_title">使用bbed修复损坏datafile header</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/04/%e9%80%9a%e8%bf%87dump%e5%88%86%e6%9e%90undo%e9%95%9c%e5%83%8f%e5%86%85%e5%ae%b9.html" rel="bookmark" class="crp_title">通过dump分析undo镜像内容</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2021/08/oracle-21c-bbed.html" rel="bookmark" class="crp_title">bbed依旧支持Oracle 21c</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2013/03/bbed%e6%a8%a1%e6%8b%9f%e6%8f%90%e4%ba%a4%e4%ba%8b%e5%8a%a1%e4%b8%80%e4%b9%8b%e4%bf%ae%e6%94%b9itl.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
