<?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; 修改bootstrap$</title>
	<atom:link href="https://www.xifenfei.com/tag/%e4%bf%ae%e6%94%b9bootstrap/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>Sat, 07 Nov 2026 15:45:44 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>修改bootstrap$影响数据库执行计划</title>
		<link>https://www.xifenfei.com/2017/02/modify-bootstrap-sql-explain-plan.html</link>
		<comments>https://www.xifenfei.com/2017/02/modify-bootstrap-sql-explain-plan.html#comments</comments>
		<pubDate>Sat, 04 Feb 2017 15:38:18 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[bootstrap$]]></category>
		<category><![CDATA[修改bootstrap$]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=7004</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2017/02/modify-bootstrap-sql-explain-plan.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/2017/02/modify-bootstrap-sql-explain-plan.html" target="_blank">修改bootstrap$影响数据库执行计划</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>在以前的文章中，我写过通过<a href="//www.xifenfei.com/2013/10/%e4%bd%bf%e7%94%a8ultraedit%e4%bf%ae%e6%94%b9oracle%e4%ba%8c%e8%bf%9b%e5%88%b6%e6%96%87%e4%bb%b6.html" title="使用UltraEdit修改oracle二进制文件">ue修改oracle二进制文件</a>实现数据库启动的sql执行计划，这里再次提供另外一种方法，通过修改bootstrap$表实现数据库启动sql执行计划。这里试验的是数据库不走i_undo1 index。<em>[此方法危害性巨大仅供测试]</em><br />
<strong>跟踪数据库正常启动过程</strong></p>
<pre class="brush: bash; title: ; notranslate">
[oracle@localhost .oradata]$ ss

SQL*Plus: Release 11.2.0.1.0 Production on Sat Feb 4 23:07:41 2017

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL&gt; startup mount;
ORACLE instance started.

Total System Global Area 2421825536 bytes
Fixed Size                  2215744 bytes
Variable Size            1828716736 bytes
Database Buffers          570425344 bytes
Redo Buffers               20467712 bytes
Database mounted.
SQL&gt; oradebug setmypid
Statement processed.
SQL&gt; oradebug EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12
Statement processed.
SQL&gt; oradebug TRACEFILE_NAME
/opt/oracle/diag/rdbms/test/test/trace/test_ora_19003.trc
SQL&gt; alter database open;

Database altered.

SQL&gt; exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
</pre>
<p><strong>分析10046 trace文件</strong></p>
<pre class="brush: bash; title: ; notranslate">
PARSING IN CURSOR #2 len=196 dep=1 uid=0 oct=9 lid=0 tim=1486220893978359 hv=24291558 ad='ef95ff70' sqlid='fqkyj700r5a76'
CREATE UNIQUE INDEX I_UNDO1 ON UNDO$(US#) PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE 
(  INITIAL 64K NEXT 1024K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 OBJNO 34 EXTENTS (FILE 1 BLOCK 320))
END OF STMT
PARSE #2:c=0,e=565,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,plh=241391319,tim=1486220893978358
EXEC #2:c=0,e=123,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=241391319,tim=1486220893978566
STAT #2 id=1 cnt=0 pid=0 pos=1 obj=0 op='INDEX BUILD UNIQUE I_UNDO1 (cr=0 pr=0 pw=0 time=0 us)'
STAT #2 id=2 cnt=0 pid=1 pos=1 obj=0 op='SORT CREATE INDEX (cr=0 pr=0 pw=0 time=0 us cost=0 size=0 card=0)'
STAT #2 id=3 cnt=0 pid=2 pos=1 obj=15 op='TABLE ACCESS FULL UNDO$ (cr=0 pr=0 pw=0 time=0 us)'
CLOSE #2:c=0,e=5,dep=1,type=0,tim=1486220893978690

…………

PARSING IN CURSOR #5 len=142 dep=1 uid=0 oct=3 lid=0 tim=1486220894169144 hv=361892850 ad='ef934cb0' sqlid='7bd391hat42zk'
select /*+ rule */ name,file#,block#,status$,user#,undosqn,xactsqn,scnbas,scnwrp,DECODE(inst#,0,NULL,inst#),ts#,spare1 from undo$ where us#=:1
END OF STMT
PARSE #5:c=0,e=474,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=3,plh=0,tim=1486220894169143
BINDS #5:
 Bind#0
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=7f4f4556b0a8  bln=22  avl=02  flg=05
  value=1
EXEC #5:c=1000,e=802,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=3,plh=906473769,tim=1486220894170055
WAIT #5: nam='db file sequential read' ela= 1018 file#=1 block#=321 blocks=1 obj#=34 tim=1486220894171138
WAIT #5: nam='db file sequential read' ela= 2620 file#=1 block#=225 blocks=1 obj#=15 tim=1486220894173817
FETCH #5:c=0,e=3770,p=2,cr=2,cu=0,mis=0,r=1,dep=1,og=3,plh=906473769,tim=1486220894173859
STAT #5 id=1 cnt=1 pid=0 pos=1 obj=15 op='TABLE ACCESS BY INDEX ROWID UNDO$ (cr=2 pr=2 pw=0 time=0 us)'
STAT #5 id=2 cnt=1 pid=1 pos=1 obj=34 op='INDEX UNIQUE SCAN I_UNDO1 (cr=1 pr=1 pw=0 time=0 us)'
CLOSE #5:c=0,e=9,dep=1,type=0,tim=1486220894173944
</pre>
<p>这些trace文件比较明显的展示了数据库在启动过程中,先是create index i_undo1,然后from undo$ where us#=:1走I_UNDO1 index访问。<br />
<br />
<strong>删除i_undo1 在bootstrap$中信息</strong></p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; select line#,obj#,sql_text from bootstrap$ where sql_text like '%I_UNDO1%';

     LINE#       OBJ#
---------- ----------
SQL_TEXT
--------------------------------------------------------------------------------
        34         34
CREATE UNIQUE INDEX I_UNDO1 ON UNDO$(US#) PCTFREE 10 INITRANS 2 MAXTRANS 255 STO
RAGE (  INITIAL 64K NEXT 1024K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0
OBJNO 34 EXTENTS (FILE 1 BLOCK 320))


SQL&gt; DELETE FROM BOOTSTRAP$ WHERE OBJ#=34;

1 row deleted.

SQL&gt; COMMIT;

Commit complete.

SQL&gt; SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
</pre>
<p><strong>再次跟踪数据库启动</strong></p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; STARTUP MOUNT;
ORACLE instance started.

Total System Global Area 2421825536 bytes
Fixed Size                  2215744 bytes
Variable Size            1828716736 bytes
Database Buffers          570425344 bytes
Redo Buffers               20467712 bytes
Database mounted.
SQL&gt; oradebug setmypid
Statement processed.
SQL&gt; oradebug EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12
Statement processed.
SQL&gt; oradebug TRACEFILE_NAME
/opt/oracle/diag/rdbms/test/test/trace/test_ora_19205.trc
SQL&gt; alter database Open;

Database altered.

</pre>
<p><strong>再次分析10046 trace文件</strong></p>
<pre class="brush: bash; title: ; notranslate">
PARSING IN CURSOR #5 len=142 dep=1 uid=0 oct=3 lid=0 tim=1486221250365628 hv=361892850 ad='ef935ce0' sqlid='7bd391hat42zk'
select /*+ rule */ name,file#,block#,status$,user#,undosqn,xactsqn,scnbas,scnwrp,DECODE(inst#,0,NULL,inst#),ts#,spare1 from undo$ where us#=:1
END OF STMT
PARSE #5:c=1000,e=536,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=3,plh=0,tim=1486221250365627
BINDS #5:
 Bind#0
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=7f89004340a8  bln=22  avl=02  flg=05
  value=1
EXEC #5:c=1000,e=727,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=3,plh=3995376916,tim=1486221250366467
WAIT #5: nam='db file sequential read' ela= 12 file#=1 block#=224 blocks=1 obj#=15 tim=1486221250366534
WAIT #5: nam='db file sequential read' ela= 10 file#=1 block#=225 blocks=1 obj#=15 tim=1486221250366606
FETCH #5:c=0,e=147,p=2,cr=3,cu=0,mis=0,r=1,dep=1,og=3,plh=3995376916,tim=1486221250366647
STAT #5 id=1 cnt=1 pid=0 pos=1 obj=15 op='TABLE ACCESS FULL UNDO$ (cr=3 pr=2 pw=0 time=0 us)'
CLOSE #5:c=0,e=39,dep=1,type=0,tim=1486221250366717
</pre>
<p>这次的trace文件中已经没有了create index i_undo1，而且对于undo$ where us#=:1的访问是通过全表扫描undo$来实现的。通过这里已经清晰证明通过修改bootstrap$表内容，可以影响数据库启动的sql执行计划。</p>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2013/12/%e6%9b%bf%e6%8d%a2bootstarp%e8%a1%a8.html" rel="bookmark" class="crp_title">替换bootstarp$表</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2013/12/%e9%80%9a%e8%bf%87bbed%e6%9b%bf%e6%8d%a2bootstarp%e8%a1%a8.html" rel="bookmark" class="crp_title">通过bbed替换bootstarp$表</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2013/10/%e4%bd%bf%e7%94%a8ultraedit%e4%bf%ae%e6%94%b9oracle%e4%ba%8c%e8%bf%9b%e5%88%b6%e6%96%87%e4%bb%b6.html" rel="bookmark" class="crp_title">使用UltraEdit修改oracle二进制文件</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2018/08/bootstrap-ora-03113-ora-07445-lmebucp.html" rel="bookmark" class="crp_title">由于bootstrap$异常导致数据库启动报ORA-03113 ORA-07445 lmebucp</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/06/oracle-11g%e4%b8%a2%e5%a4%b1access%e6%81%a2%e5%a4%8d%e6%96%b9%e6%b3%95.html" rel="bookmark" class="crp_title">Oracle 11g丢失access$恢复方法</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2024/05/truncate-idl_ub1-open-hang.html" rel="bookmark" class="crp_title">truncate IDL_UB1$导致数据库open hang</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2024/07/ora-600-6711.html" rel="bookmark" class="crp_title">数据库启动报ORA-600 6711故障分析处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2013/06/oracle-12c-cdb%e4%b8%adpdb%e5%8f%82%e6%95%b0%e7%ae%a1%e7%90%86%e6%9c%ba%e5%88%b6.html" rel="bookmark" class="crp_title">ORACLE 12C CDB中PDB参数管理机制</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2021/02/ora-00600-16513-1403.html" rel="bookmark" class="crp_title">ORA-00600: internal error code, arguments: [16513], [1403] 恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/07/%e6%9c%aa%e6%94%b6%e9%9b%86%e7%bb%9f%e8%ae%a1%e4%bf%a1%e6%81%af%e5%af%b9%e8%b1%a1-%e6%89%a7%e8%a1%8csql%e5%8a%a8%e6%80%81%e9%87%87%e6%a0%b7.html" rel="bookmark" class="crp_title">未收集统计信息对象&#8212;执行sql动态采样</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2014/10/%e8%a7%a3%e5%86%b3ora-00701-object-necessary-for-warmstarting-database-cannot-be-altered%e9%94%99%e8%af%af.html" rel="bookmark" class="crp_title">bootstrap$核心index(I_OBJ1,I_USER1,I_FILE#_BLOCK#,I_IND1,I_TS#,I_CDEF1等)异常恢复&#8212;ORA-00701错误解决</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2013/08/%e6%a8%a1%e6%8b%9f%e5%9f%ba%e8%a1%a8%e4%ba%8b%e5%8a%a1%e6%9c%aa%e6%8f%90%e4%ba%a4%e6%95%b0%e6%8d%ae%e5%ba%93crashundo%e4%b8%a2%e5%a4%b1%e6%81%a2%e5%a4%8d%e5%bc%82%e5%b8%b8%e6%81%a2%e5%a4%8d.html" rel="bookmark" class="crp_title">模拟基表事务未提交数据库crash,undo丢失恢复异常恢复</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2017/02/modify-bootstrap-sql-explain-plan.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
