﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-jinfeng_wang-随笔分类-oracle</title><link>http://www.blogjava.net/jinfeng_wang/category/42248.html</link><description>G-G-S,D-D-U!</description><language>zh-cn</language><lastBuildDate>Mon, 26 Oct 2009 16:27:38 GMT</lastBuildDate><pubDate>Mon, 26 Oct 2009 16:27:38 GMT</pubDate><ttl>60</ttl><item><title>sql_trace and tkprof</title><link>http://www.blogjava.net/jinfeng_wang/archive/2009/10/25/299664.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Sun, 25 Oct 2009 06:29:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2009/10/25/299664.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/299664.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2009/10/25/299664.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/299664.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/299664.html</trackback:ping><description><![CDATA[session1&nbsp; (sysdba)<br />
&nbsp;&nbsp;&nbsp;&nbsp;1) :&nbsp;alter session set timed_statistics=true;<br />
<br />
&nbsp;&nbsp;&nbsp; 2 ) select * from v$session where v$session.USERNAME='SCOTT'; //find the trace session<br />
<br />
&nbsp;&nbsp;&nbsp; 3)&nbsp;&nbsp;exec dbms_system.set_sql_trace_in_session(25,6,true);&nbsp; //open the sql_trace for the session<br />
<br />
session2&nbsp; (scott)<br />
&nbsp;&nbsp;&nbsp; 4) select * from t;<br />
<br />
session 1(sysbda)<br />
&nbsp;&nbsp;&nbsp; 5) exec dbms_system.set_sql_trace_in_session(25,6,false); //close the sql_trace<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; 6) show parameter user_dump;&nbsp; //get the&nbsp;trace file path<br />
<br />
session 3: OS, <br />
&nbsp;&nbsp;&nbsp;&nbsp;7) &nbsp;cd /opt/oracle/diag/rdbms/orcl/orcl/trace<br />
&nbsp;&nbsp;&nbsp; 8)&nbsp;ll -t&nbsp; *.trc&nbsp;&nbsp; //get the last trc file<br />
<br />
&nbsp;&nbsp;&nbsp; 9)&nbsp;/opt/oracle/product/11.1.x/bin/tkprof /opt/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_7688.trc /opt/oracle/diag/rdbms/orcl/orcl/trace/<br />
orcl_ora_7688.trc.txt<br />
<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp; <br />
<img src ="http://www.blogjava.net/jinfeng_wang/aggbug/299664.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2009-10-25 14:29 <a href="http://www.blogjava.net/jinfeng_wang/archive/2009/10/25/299664.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>利用 SQL Access Advisor 改进模式设计 zz</title><link>http://www.blogjava.net/jinfeng_wang/archive/2009/10/24/299567.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Sat, 24 Oct 2009 05:59:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2009/10/24/299567.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/299567.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2009/10/24/299567.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/299567.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/299567.html</trackback:ping><description><![CDATA[<a href="http://www.oracle.com/technology/global/cn/obe/11gr1_db/manage/sqlaccadv/sqlaccadv.htm">http://www.oracle.com/technology/global/cn/obe/11gr1_db/manage/sqlaccadv/sqlaccadv.htm</a>&nbsp; <br />
<br />
<h3 class="topstoryhead">利用 SQL Access Advisor 改进模式设计</h3>
<h4 class="navheader">目的</h4>
<p class="bodycopy">本教程将向您说明如何使用 SQL Access Advisor 改进模式设计。 </p>
<p class="navheader">所需时间</p>
<p class="bodycopy">大约 40 分钟 </p>
<h3 class="Overview"><a name="t"></a><span class="navheader">主题</span></h3>
<p class="bodycopy">本教程包括下列主题：</p>
<table cellspacing="0" cellpadding="1" width="270" border="0">
    <tbody>
        <tr valign="top">
            <td width="16"><img height="16" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/bullet.gif" width="16"  alt="" /></td>
            <td class="bodylink" width="218"><a href="http://www.oracle.com/technology/global/cn/obe/11gr1_db/manage/sqlaccadv/sqlaccadv.htm#o">概述</a></td>
        </tr>
        <tr valign="top">
            <td><img height="16" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/bullet.gif" width="16"  alt="" /></td>
            <td class="bodylink"><a href="http://www.oracle.com/technology/global/cn/obe/11gr1_db/manage/sqlaccadv/sqlaccadv.htm#p">前提条件</a></td>
        </tr>
        <tr valign="top">
            <td><img height="16" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/bullet.gif" width="16"  alt="" /></td>
            <td class="boldbodylink"><a class="bodylink" href="http://www.oracle.com/technology/global/cn/obe/11gr1_db/manage/sqlaccadv/sqlaccadv.htm#imp">使用 SQL Access Advisor</a></td>
        </tr>
        <tr valign="top">
            <td><img height="16" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/bullet.gif" width="16"  alt="" /></td>
            <td class="bodylink"><a href="http://www.oracle.com/technology/global/cn/obe/11gr1_db/manage/sqlaccadv/sqlaccadv.htm#s">总结</a></td>
        </tr>
    </tbody>
</table>
<h4 class="navheader">查看屏幕截图</h4>
<p class="bodycopy"><img onmouseover="showAllImages()" height="24" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/view_image.gif" width="24" align="absMiddle"  alt="" /> <strong><span class="style1"><font face="Arial, Helvetica, sans-serif" color="#ff0000">将鼠标置于此图标上</font><font color="#ff0000">可以加载和查看本教程的所有屏幕截图。 <strong>（警告：因为此操作会同时加载所有屏幕截图，所以网速较慢时，响应时间可能会比较长。）</strong> </font><font color="#ff0000"></font></span></strong></p>
<p class="bodycopy"><strong>注：</strong>此外，您还可以在下列步骤中将鼠标放在每个单独的图标上，从而仅加载和查看与该步骤相关的屏幕截图。可以通过单击各个屏幕截图来将其隐藏。 </p>
<h3 class="Overview"><a name="o"></a><span class="navheader">概述</span></h3>
<p class="bodycopy">定义相应的访问结构以优化 SQL 查询始终是 Oracle DBA 要考虑的问题。因此，为解决这一问题，人们编写了许多技术文章和脚本，还开发了不少高端工具。此外，随着分区和物化视图技术的发展，确定访问结构变得愈加复杂。为解决这一非常重要的需求，Oracle 数据库 10g 和 11g 引入了 SQL Access Advisor，从而改进了可管理性。</p>
<p class="bodycopy">SQL Access Advisor 通过建议要创建、删除或保留的索引、物化视图、物化视图日志或分区来确定并帮助解决与 SQL 语句执行相关的性能问题。它可以通过 Database Control 运行，也可以通过命令行使用 PL/SQL 过程运行。</p>
<p align="right"><a class="bodylink" href="http://www.oracle.com/technology/global/cn/obe/11gr1_db/manage/sqlaccadv/sqlaccadv.htm#t">返回主题列表</a></p>
<h3 class="navheader"><a name="p"></a>前提条件</h3>
<p class="bodycopy">开始本教程之前，您应该： </p>
<table cellspacing="0" cellpadding="1" width="650" border="0">
    <tbody>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>1.</strong></td>
            <td colspan="2">
            <p class="bodycopy">安装 Oracle 数据库 11g。</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy"><strong>2.</strong></td>
            <td colspan="2">
            <p class="bodycopy">下载 <a class="style1" href="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/files/sqlaccadv.zip">sqlaccadv.zip</a> 文件并将其解压缩到您的工作目录（即 wkdir），然后导航到您的工作目录。</p>
            </td>
        </tr>
    </tbody>
</table>
<p class="bodycopy" align="right"><a class="bodylink" href="http://www.oracle.com/technology/global/cn/obe/11gr1_db/manage/sqlaccadv/sqlaccadv.htm#t">返回主题列表</a></p>
<h3 class="Install"><a id="t1" name="imp"></a><span class="navheader">使用 SQL Access Advisor</span></h3>
<p class="bodycopy style14">SQL Access Advisor 将实际负载作为输入，Advisor 也可以通过模式获得假定的负载。然后，它会建议可提供更快执行路径的访问结构。它具有以下优点：</p>
<ul>
    <li class="bodycopy">无需掌握专业知识。
    <li class="bodycopy">根据实际驻留在基于成本的优化器中的规则做决定。
    <li class="bodycopy">与优化器和 Oracle 数据库增强同步。
    <li class="bodycopy">是一个涵盖 SQL 访问方法各个方面的单一顾问程序。
    <li class="bodycopy">提供简单、用户友好的 GUI 向导。
    <li class="bodycopy">生成脚本来实施建议。 </li>
</ul>
<p class="bodycopy style14">下面的例子说明了 SQL Access Advisor 可以提供的建议的类型。该例子还使用 SQL Performance Analyzer 证明 SQL Access Advisor 提供的建议很好。</p>
<p class="bodycopy style14">执行以下步骤，了解 SQL Access Advisor 的用法：</p>
<table cellspacing="0" cellpadding="1" width="650" border="0">
    <tbody>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>1.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">在以 <strong>oracle</strong> 用户身份连接的终端会话中，执行 <span class="style16"><strong><font face="Courier New, Courier, mono">sqlaccessadv_setup.sh</font></strong></span> 脚本。该脚本将生成本 OBE 中使用的所有必需的数据。尤其是，它将生成用于表示要分析的负载的 SQL 调整工具集。</p>
            <p class="bodycopy"><span class="bodycopy style2"><strong><font face="Courier New, Courier, mono">./sqlaccessadv_setup.sh</font></strong></span></p>
            <p><img class="imgborder_on" id="sqlaccadv001" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv001.gif" border="1" name="sqlaccadv001"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>2.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">以 <strong>sh</strong>用户身份（口令 sh）连接到 Enterprise Manager Database Control。进入 Home 页面后，单击 Related Links 部分中的 <strong>Advisor Central</strong> 链接。</p>
            <p><img class="imgborder_on" id="sqlaccadv002" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv002.gif" border="1" name="sqlaccadv002"  alt="" /></p>
            <p><img class="imgborder_on" id="sqlaccadv003" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv003.gif" border="1" name="sqlaccadv003"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>3.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">在 Advisor Central 页面中，单击 <strong>SQL Advisors</strong> 链接。然后在 SQL Advisors 页面中，单击 <strong>SQL Access Advisor</strong> 链接。</p>
            <p><img class="imgborder_on" id="sqlaccadv004" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv004.gif" border="1" name="sqlaccadv004"  alt="" /></p>
            <p><img class="imgborder_on" id="sqlaccadv005" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv005.gif" border="1" name="sqlaccadv005"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>4.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">在 Initial Options 页面中，选择 <strong>Inherit Options from a previously saved Task or Template</strong>，然后选择 <strong>SQLACCESS_WAREHOUSE</strong> 模板。完成以上操作后，单击 <strong>Continue</strong>。</p>
            <p><img class="imgborder_on" id="sqlaccadv006" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv006.gif" border="1" name="sqlaccadv006"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>5.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">在 Workload Source 页面中，选择 <strong>Use an existing SQL Tuning Set</strong> 并在 SQL Tuning Set 域中输入 <span class="style19">SH.SQLSET_MY_SQLACCESS_WORKLOAD</span>。该 SQL 调整工具集是以前生成的。它表示您要分析的仓库负载。完成以上操作后，单击 <strong>Continue</strong>。</p>
            <p><img class="imgborder_on" id="sqlaccadv009" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv009.gif" border="1" name="sqlaccadv009"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>6.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">在 Recommendation Options 页面中，确保已选择所有可能的访问结构并选择了 Comprehensive。完成以上操作后，单击 <strong>Continue</strong>。</p>
            <p><img class="imgborder_on" id="sqlaccadv010" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv010.gif" border="1" name="sqlaccadv010"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>7.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">在 Schedule 页面的 Task Name 域中输入 <span class="style19">MY_SQLACCESS_TASK</span>。从提供的列表中选择第一个时区（单击火炬图标）。完成以上操作后，单击 <strong>Continue</strong>。</p>
            <p><img class="imgborder_on" id="sqlaccadv011" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv011.gif" border="1" name="sqlaccadv011"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>8.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">在 Review 页面中，单击 <strong>Submit</strong>。</p>
            <p><img class="imgborder_on" id="sqlaccadv012" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv012.gif" border="1" name="sqlaccadv012"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>9.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">返回 Advisor Central 页面，单击 <strong>Refresh</strong>。完成以上操作后，单击 Results 表中的 <span class="style19">MY_SQLACCESS_TASK</span> 链接。该任务应处于 COMPLETED 状态。</p>
            <p><img class="imgborder_on" id="sqlaccadv013" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv013.gif" border="1" name="sqlaccadv013"  alt="" /></p>
            <p><img class="imgborder_on" id="sqlaccadv014" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv014.gif" border="1" name="sqlaccadv014"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>10.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">这将转至 Results 页面。通过该页面，您可以看到针对该负载实施 SQL Access Advisor 建议的潜在好处。单击 <strong>Recommendation</strong> 子选项卡。</p>
            <p><img class="imgborder_on" id="sqlaccadv015" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv015.gif" border="1" name="sqlaccadv015"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>11.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">在 Recommendations 子页面中，您可以查看建议的高级概述。基本上，会为该负载生成所有可能的建议类型。确保已选择所有建议，单击 Recommendation Details 按钮。这将转至 Details 页面，您可以在其中看到有关每个建议的更多详细信息，以及该负载中受这些建议影响的相应 SQL 语句。单击 <strong>OK</strong>。</p>
            <p><img class="imgborder_on" id="sqlaccadv016" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv016.gif" border="1" name="sqlaccadv016"  alt="" /></p>
            <p><img class="imgborder_on" id="sqlaccadv017" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv017.gif" border="1" name="sqlaccadv017"  alt="" /></p>
            <p><img class="imgborder_on" id="sqlaccadv018" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv018.gif" border="1" name="sqlaccadv018"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>12.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">返回 Recommendations 子页面，单击 <strong>Schedule Implementation</strong> 按钮。</p>
            <p><img class="imgborder_on" id="sqlaccadv019" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv019.gif" border="1" name="sqlaccadv019"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>13.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">在 Schedule Implementation 页面中，显示一个警告，表明该向导不会尝试实施其建议，因为某些建议是非常重要的更改，应由管理员认真查看。因此，单击 <strong>Show SQL</strong> 按钮查看您可以用来实施所有建议的脚本。事实上，您已经创建了该脚本并将在本 OBE 的稍后部分使用。查看了该脚本之后，单击 <strong>Done</strong>。返回 Schedule Implementation 页面，单击 <strong>Cancel</strong>。</p>
            <p><img class="imgborder_on" id="sqlaccadv020" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv020.gif" border="1" name="sqlaccadv020"  alt="" /></p>
            <p><img class="imgborder_on" id="sqlaccadv021" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv021.gif" border="1" name="sqlaccadv021"  alt="" /></p>
            <p><img class="imgborder_on" id="sqlaccadv022" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv022.gif" border="1" name="sqlaccadv022"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>14.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">单击右上角的 Database 选项卡，然后单击 Software and Support 选项卡。进入 Software and Support 页面后，单击 <strong>SQL Performance Analyzer</strong> 链接。您现在希望证明实施建议是有益处的。</p>
            <p><img class="imgborder_on" id="sqlaccadv023" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv023.gif" border="1" name="sqlaccadv023"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>15.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">在 SQL Performance Analyzer 页面中，单击 <strong>Guided Workflow</strong> 链接。</p>
            <p><img class="imgborder_on" id="sqlaccadv024" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv024.gif" border="1" name="sqlaccadv024"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>16.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">在 Guided Workflow 页面中，单击与第 1 步对应的行上的 <strong>Execute</strong> 图标。在 Create SQL Performance Analyzer Task 中，在 SQL Performance Analyzer Task 的 Name 域中输入 <span class="style19">MY_SPA_TASK</span>。然后，在 SQL 调整工具集的 Name 域中输入 <span class="style19">SH.SQLSET_MY_SQLACCESS_WORKLOAD</span>。完成以上操作后，单击 <strong>Create</strong>。</p>
            <p><img class="imgborder_on" id="sqlaccadv025" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv025.gif" border="1" name="sqlaccadv025"  alt="" /></p>
            <p><img class="imgborder_on" id="sqlaccadv026" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv026.gif" border="1" name="sqlaccadv026"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>17.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">返回 Guided Workflow 页面，单击第 2 步的 <strong>Execute</strong> 图标。在 Create Replay Trial 页面的 Replay Trial Name 域中输入 <span class="style19">MY_SQL_REPLAY_BEFORE</span>，确保选中 <strong>Trial environment established</strong> 复选框。然后，单击 <strong>Submit</strong>。</p>
            <p><img class="imgborder_on" id="sqlaccadv027" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv027.gif" border="1" name="sqlaccadv027"  alt="" /></p>
            <p><img class="imgborder_on" id="sqlaccadv028" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv028.gif" border="1" name="sqlaccadv028"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>18.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">在终端会话中，在 SQL*Plus 下以 <strong>sh</strong>用户身份（口令 sh）连接。在 SQL*Plus 会话中，执行 <span class="style16"><strong><font face="Courier New, Courier, mono">implement.sql</font></strong></span> 脚本。该脚本是与 SQL Access Advisor 会话先前生成的建议对应的预创建脚本。</p>
            <p class="bodycopy"><span class="style18"><strong><font face="Courier New, Courier, mono">@</font></strong></span><span class="bodycopy style2"><strong><font face="Courier New, Courier, mono">implement.sql</font></strong></span></p>
            <p><img class="imgborder_on" id="sqlaccadv029" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv029.gif" border="1" name="sqlaccadv029"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>19.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">返回 Guided Workflow Enterprise Manager 页面，单击与第 3 步相对应的 <strong>Execute</strong> 图标。在 Create Replay Trial 页面的 Replay Trial Name 域中输入 <span class="style19">MY_SQL_REPLAY_AFTER</span>。确保已选中 <strong>Trial environment established</strong> 复选框，然后单击 <strong>Submit</strong>。</p>
            <p><img class="imgborder_on" id="sqlaccadv030" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv030.gif" border="1" name="sqlaccadv030"  alt="" /></p>
            <p><img class="imgborder_on" id="sqlaccadv031" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv031.gif" border="1" name="sqlaccadv031"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>20.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">返回 Guided Workflow Enterprise Manager 页面，单击与第 4 步对应的 <strong>Execute</strong> 图标。在 Run Replay Trial Comparison 页面中，确保创建一个 MY_SQL_REPLAY_BEFORE 和 MY_SQL_REPLAY_AFTER 之间的比较。单击 <strong>Submit</strong>。</p>
            <p><img class="imgborder_on" id="sqlaccadv032" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv032.gif" border="1" name="sqlaccadv032"  alt="" /></p>
            <p><img class="imgborder_on" id="sqlaccadv033" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv033.gif" border="1" name="sqlaccadv033"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
        <tr valign="top">
            <td class="bodycopy" width="25"><strong>21.</strong></td>
            <td width="621" colspan="2">
            <p class="bodycopy">返回 Guided Workflow Enterprise Manager 页面，单击与第 5 步对应的 <strong>Execute</strong> 图标。在 SQL Performance Analyzer Task Result 页面上，您可以清楚地看到第二次试用较第一次快得多。</p>
            <p><img class="imgborder_on" id="sqlaccadv034" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv034.gif" border="1" name="sqlaccadv034"  alt="" /></p>
            <p><img class="imgborder_on" id="sqlaccadv035" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv035.gif" border="1" name="sqlaccadv035"  alt="" /></p>
            <p><img class="imgborder_on" id="sqlaccadv036" onmouseover="showImage(this)" onclick="hideImage(this)" src="http://www.oracle.com/technology/obe/11gr1_db/manage/sqlaccadv/images/sqlaccadv036.gif" border="1" name="sqlaccadv036"  alt="" /></p>
            <p>&nbsp;</p>
            </td>
        </tr>
    </tbody>
</table>
<p align="right"><a class="bodylink" href="http://www.oracle.com/technology/global/cn/obe/11gr1_db/manage/sqlaccadv/sqlaccadv.htm#t">返回主题列表</a><a class="bodylink" href="http://www.oracle.com/technology/global/cn/obe/11gr1_db/manage/sqlaccadv/sqlaccadv.htm#t"></a></p>
<h3 class="Install">
<p class="navheader"><a name="s"></a>总结</p>
</h3>
<p class="bodycopy">在本教程中，您学习了如何使用 SQL Access Advisor。</p>
<img src ="http://www.blogjava.net/jinfeng_wang/aggbug/299567.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2009-10-24 13:59 <a href="http://www.blogjava.net/jinfeng_wang/archive/2009/10/24/299567.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SQL Performance Analyzer in Oracle Database 11g Release 1 zz</title><link>http://www.blogjava.net/jinfeng_wang/archive/2009/10/24/299566.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Sat, 24 Oct 2009 05:58:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2009/10/24/299566.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/299566.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2009/10/24/299566.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/299566.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/299566.html</trackback:ping><description><![CDATA[<a href="http://www.oracle-base.com/articles/11g/SqlPerformanceAnalyzer_11gR1.php#sql_performance_analyzer_api">http://www.oracle-base.com/articles/11g/SqlPerformanceAnalyzer_11gR1.php#sql_performance_analyzer_api</a>&nbsp; <br />
<br />
The concept of SQL tuning sets, along with the <code>DBMS_SQLTUNE</code> package to manipulate them, was introduced in Oracle 10g as part of the <a href="http://www.oracle-base.com/articles/10g/AutomaticSQLTuning10g.php">Automatic SQL Tuning</a> functionality. Oracle 11g makes further use of SQL tuning sets with the SQL Performance Analyzer, which compares the performance of the statements in a tuning set before and after a database change. The database change can be as major or minor as you like, such as:<br />
<ul>
    <li>Database, operating system, or hardware upgrades.
    <li>Database, operating system, or hardware configuration changes.
    <li>Database initialization parameter changes.
    <li>Schema changes, such as adding indexes or materialized views.
    <li>Refreshing optimizer statistics.
    <li>Creating or changing SQL profiles. </li>
</ul>
Unlike <a href="http://www.oracle-base.com/articles/11g/DatabaseReplay_11gR1.php">Database Replay</a>, the SQL Performance Analyzer does not try and replicate the workload on the system. It just plugs through each statement gathering performance statistics.<br />
<br />
The SQL Performance Analyzer can be run manually using the <code>DBMS_SQLPA</code> package or using Enterprise Manager. This article gives an overview of both methods.<br />
<ul>
    <li><a href="http://www.oracle-base.com/articles/11g/SqlPerformanceAnalyzer_11gR1.php#setting_up">Setting Up the Test</a>
    <li><a href="http://www.oracle-base.com/articles/11g/SqlPerformanceAnalyzer_11gR1.php#tuning_set_api">Creating SQL Tuning Sets using the DBMS_SQLTUNE Package</a>
    <li><a href="http://www.oracle-base.com/articles/11g/SqlPerformanceAnalyzer_11gR1.php#sql_performance_analyzer_api">Running the SQL Performance Analyzer using the DBMS_SQLPA Package</a>
    <li><a href="http://www.oracle-base.com/articles/11g/SqlPerformanceAnalyzer_11gR1.php#tuning_set_em">Creating SQL Tuning Sets using Enterprise Manager</a>
    <li><a href="http://www.oracle-base.com/articles/11g/SqlPerformanceAnalyzer_11gR1.php#sql_performance_analyzer_em">Running the SQL Performance Analyzer using Enterprise Manager</a>
    <li><a href="http://www.oracle-base.com/articles/11g/SqlPerformanceAnalyzer_11gR1.php#optimizer_upgrade_simulation">Optimizer Upgrade Simulation</a>
    <li><a href="http://www.oracle-base.com/articles/11g/SqlPerformanceAnalyzer_11gR1.php#parameter_change">Parameter Change</a>
    <li><a href="http://www.oracle-base.com/articles/11g/SqlPerformanceAnalyzer_11gR1.php#transferring_tuning_sets">Transferring SQL Tuning Sets</a> </li>
</ul>
<a id="setting_up"></a>
<h2>Setting Up the Test</h2>
The SQL performance analyzer requires SQL tuning sets, and SQL tuning sets are pointless unless they contain SQL, so the first task should be to issue some SQL statements. We are only trying to demonstrate the technology, so the example can be really simple. The following code creates a test user called <code>SPA_TEST_USER</code>.<br />
<blockquote>
<pre>CONN sys/password@prod AS SYSDBA
CREATE USER spa_test_user IDENTIFIED BY spa_test_user
QUOTA UNLIMITED ON users;
GRANT CONNECT, CREATE TABLE TO spa_test_user;</pre>
</blockquote>Next, connect to the test user and create a test table called <code>MY_OBJECTS</code> using a query from the <code>ALL_OBJECTS</code> view.<br />
<blockquote>
<pre>CONN spa_test_user/spa_test_user@prod
CREATE TABLE my_objects AS
SELECT * FROM all_objects;
EXEC DBMS_STATS.gather_table_stats(USER, 'MY_OBJECTS', cascade =&gt; TRUE);</pre>
</blockquote>This schema represents our "before" state. Still logged in as the test user, issue the following statements.<br />
<blockquote>
<pre>SELECT COUNT(*) FROM my_objects WHERE object_id &lt;= 100;
SELECT object_name FROM my_objects WHERE object_id = 100;
SELECT COUNT(*) FROM my_objects WHERE object_id &lt;= 1000;
SELECT object_name FROM my_objects WHERE object_id = 1000;
SELECT COUNT(*) FROM my_objects WHERE object_id BETWEEN 100 AND 1000;</pre>
</blockquote>Notice, all statements make reference to the currently unindexed <code>OBJECT_ID</code> column. Later we will be indexing this column to create our changed "after" state.<br />
<br />
The select statements are now in the shared pool, so we can start creating an SQL tuning set.<br />
<a id="tuning_set_api"></a>
<h2>Creating SQL Tuning Sets using the DBMS_SQLTUNE Package</h2>
The <code>DBMS_SQLTUNE</code> package contains procedures and functions that allow us to create, manipulate and drop SQL tuning sets. The first step is to create an SQL tuning set called <code>spa_test_sqlset</code> using the <code>CREATE_SQLSET</code> procedure.<br />
<blockquote>
<pre>CONN sys/password@prod AS SYSDBA
EXEC DBMS_SQLTUNE.create_sqlset(sqlset_name =&gt; 'spa_test_sqlset');</pre>
</blockquote>Next, the <code>SELECT_CURSOR_CACHE</code> table function is used to retrieve a cursor containing all SQL statements that were parsed by the <code>SPA_TEST_USER</code> schema and contain the word "my_objects". The resulting cursor is loaded into the tuning set using the <code>LOAD_SQLSET</code> procedure.<br />
<blockquote>
<pre>DECLARE
l_cursor  DBMS_SQLTUNE.sqlset_cursor;
BEGIN
OPEN l_cursor FOR
SELECT VALUE(a)
FROM   TABLE(
DBMS_SQLTUNE.select_cursor_cache(
basic_filter   =&gt; 'sql_text LIKE ''%my_objects%'' and parsing_schema_name = ''SPA_TEST_USER''',
attribute_list =&gt; 'ALL')
) a;
DBMS_SQLTUNE.load_sqlset(sqlset_name     =&gt; 'spa_test_sqlset',
populate_cursor =&gt; l_cursor);
END;
/</pre>
</blockquote>The <code>DBA_SQLSET_STATEMENTS</code> view allows us to see which statements have been associated with the tuning set.<br />
<blockquote>
<pre>SELECT sql_text
FROM   dba_sqlset_statements
WHERE  sqlset_name = 'spa_test_sqlset';
SQL_TEXT
--------------------------------------------------------------------------------
SELECT object_name FROM my_objects WHERE object_id = 100
SELECT COUNT(*) FROM my_objects WHERE object_id &lt;= 100
SELECT COUNT(*) FROM my_objects WHERE object_id BETWEEN 100 AND 1000
SELECT COUNT(*) FROM my_objects WHERE object_id &lt;= 1000
SELECT object_name FROM my_objects WHERE object_id = 1000
5 rows selected.
SQL&gt;</pre>
</blockquote>Now we have an SQL tuning set, we can start using the SQL performance analyzer.<br />
<a id="sql_performance_analyzer_api"></a>
<h2>Running the SQL Performance Analyzer using the DBMS_SQLPA Package</h2>
The <code>DBMS_SQLPA</code> package is the PL/SQL API used to manage the SQL performance ananlyzer. The first step is to create an analysis task using the <code>CREATE_ANALYSIS_TASK</code> function, passing in the SQL tuning set name and making a note of the resulting task name.<br />
<blockquote>
<pre>CONN sys/password@prod AS SYSDBA
VARIABLE v_task VARCHAR2(64);
EXEC :v_task :=  DBMS_SQLPA.create_analysis_task(sqlset_name =&gt; 'spa_test_sqlset');
PL/SQL procedure successfully completed.
SQL&gt; PRINT :v_task
V_TASK
--------------------------------------------------------------------------------
TASK_122
SQL&gt;</pre>
</blockquote>Next, use the <code>EXECUTE_ANALYSIS_TASK</code> procedure to execute the contents of the SQL tuning set against the current state of the database to gather information about the performance before any modifications are made. This analysis run is named <code>before_change</code>.<br />
<blockquote>
<pre>BEGIN
DBMS_SQLPA.execute_analysis_task(
task_name       =&gt; :v_task,
execution_type  =&gt; 'test execute',
execution_name  =&gt; 'before_change');
END;
/</pre>
</blockquote>Now we have the "before" performance information, we need to make a change so we can test the "after" performance. For this example we will simply add an index to the test table on the <code>OBJECT_ID</code> column. In a new SQL*Plus session create the index using the following statements.<br />
<blockquote>
<pre>CONN spa_test_user/spa_test_user@prod
CREATE INDEX my_objects_index_01 ON my_objects(object_id);
EXEC DBMS_STATS.gather_table_stats(USER, 'MY_OBJECTS', cascade =&gt; TRUE);</pre>
</blockquote>Now, we can return to our original session and test the performance after the database change. Once again use the <code>EXECUTE_ANALYSIS_TASK</code> procedure, naming the analysis task "after_change".<br />
<blockquote>
<pre>BEGIN
DBMS_SQLPA.execute_analysis_task(
task_name       =&gt; :v_task,
execution_type  =&gt; 'test execute',
execution_name  =&gt; 'after_change');
END;
/</pre>
</blockquote>Once the before and after analysis tasks are complete, we must run a comparison analysis task. The following code explicitly names the analysis tasks to compare using name-value pairs in the <code>EXECUTION_PARAMS</code> parameter. If this is ommited, the latest two analysis runs are compared.<br />
<blockquote>
<pre>BEGIN
DBMS_SQLPA.execute_analysis_task(
task_name        =&gt; :v_task,
execution_type   =&gt; 'compare performance',
execution_params =&gt; dbms_advisor.arglist(
'execution_name1',
'before_change',
'execution_name2',
'after_change')
);
END;
/</pre>
</blockquote>With this final analysis run complete, we can check out the comparison report using the <code>REPORT_ANALYSIS_TASK</code> function. The function returns a CLOB containing the report in text or HTML format. The script below spools the default text format report out to a file.<br />
<blockquote>
<pre>SET LONG 1000000
SET PAGESIZE 0
SET LINESIZE 200
SET LONGCHUNKSIZE 200
SET TRIMSPOOL ON
SPOOL /tmp/execute_comparison_report.txt
SELECT DBMS_SQLPA.report_analysis_task(:v_task)
FROM   dual;
SPOOL OFF</pre>
</blockquote>An example of this file can be seen <a href="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/execute_comparison_report.txt">here</a>.<br />
<a id="tuning_set_em"></a>
<h2>Creating SQL Tuning Sets using Enterprise Manager</h2>
Click on the "SQL Tuning Sets" link towards the bottom of the "Performance" tab.<br />
<br />
<img alt="SQL Tuning Sets Link" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/01-SqlTuningSetsLink.jpg" /><br />
<br />
On the "SQL Tuning Sets" screen, click the "Create" button.<br />
<br />
<img alt="SQL Tuning Sets" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/02-SqlTuningSets.jpg" /><br />
<br />
Enter a name for the SQL tuning set and click the "Next" button.<br />
<br />
<img alt="Options" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/03-Options.jpg" /><br />
<br />
Select the "Load SQL statements one time only" option, select the "Cursor Cache" as the data source, then click the "Next" button.<br />
<br />
<img alt="Load Methods" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/04-LoadMethods.jpg" /><br />
<br />
Set the appropriate values for the "Parsing Schema Name" and "SQL Text" filter attributes, remove any extra attributes by clicking their remove icons, then click the "Next" button.<br />
<br />
<img alt="Filter Options" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/05-FilterOptions.jpg" /><br />
<br />
Accept the immediate schedule by clicking the "Next" button.<br />
<br />
<img alt="Schedule" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/06-Schedule.jpg" /><br />
<br />
Assuming the review information looks correct, click the "Submit" button.<br />
<br />
<img alt="Review" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/07-Review.jpg" /><br />
<br />
The "SQL Tuning Sets" screen shows the confirmation of the tuning set creation and the scheduled job to populate it.<br />
<br />
<img alt="Confirmation" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/08-Confirmation.jpg" /><br />
<br />
Once the population job completes, clicking on the SQL tuning set displays its contents.<br />
<br />
<img alt="SQL Tuning Set Contents" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/09-SqlTuningSetContents.jpg" /><br />
<br />
Now we have an SQL tuning set, we can start using the SQL performance analyzer.<br />
<a id="sql_performance_analyzer_em"></a>
<h2>Running the SQL Performance Analyzer using Enterprise Manager</h2>
Click the "SQL Performance Analayzer" link on the "Software and Support" tab.<br />
<br />
<img alt="SQL Performance Analyzer Link" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/10-SqlPerformanceAnalyzerLink.jpg" /><br />
<br />
Click the "Guided Workflow" link on the "SQL Performance Analayzer" screen.<br />
<br />
<img alt="Guided Workflow" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/11-GuidedWorkflow.jpg" /><br />
<br />
Click the execute icon on the first step to create the SQL Performance Analyzer task.<br />
<br />
<img alt="Create SPA Task Icon" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/12-CreateSpaTaskIcon.jpg" /><br />
<br />
Enter a name for the SPA task, select the SQL tuning set to associate with it, then click the "Create" button.<br />
<br />
<img alt="Create SPA Task" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/13-CreateSpaTask.jpg" /><br />
<br />
When the status of the previous step becomes a green tick, click the execute icon on the second step to capture the SQL tuning set performance information of the "before" state.<br />
<br />
<img alt="Replay Before Icon" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/14-ReplayBeforeIcon.jpg" /><br />
<br />
Enter a "Replay Trial Name" of "before_change", check the "Trial environment established" checkbox, then click the "Submit" button.<br />
<br />
<img alt="Replay Before" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/15-ReplayBefore.jpg" /><br />
<br />
When the status of the previous step becomes a green tick, click the execute icon on the third step to capture the SQL tuning set performance information of the "after" state.<br />
<br />
<img alt="Replay After Icon" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/16-ReplayAfterIcon.jpg" /><br />
<br />
Alter the state of the database by creating an index on the <code>OBJECT_ID</code> column of the test table.<br />
<blockquote>
<pre>CONN spa_test_user/spa_test_user@prod
CREATE INDEX my_objects_index_01 ON my_objects(object_id);
EXEC DBMS_STATS.gather_table_stats(USER, 'MY_OBJECTS', cascade =&gt; TRUE);</pre>
</blockquote>Enter a "Replay Trial Name" of "after_change", check the "Trial environment established" checkbox, then click the "Submit" button.<br />
<br />
<img alt="Replay After" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/17-ReplayAfter.jpg" /><br />
<br />
When the status of the previous step becomes a green tick, click the execute icon on the forth step to run a comparison analysis task.<br />
<br />
<img alt="Compare Icon" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/18-CompareIcon.jpg" /><br />
<br />
Accept the default "Trial 1 Name" and "Trial 2 Name" settings by clicking the "Submit" button.<br />
<br />
<img alt="Compare" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/19-Compare.jpg" /><br />
<br />
When the status of the previous step becomes a green tick, click the execute icon on the fifth step to view the comparison report.<br />
<br />
<img alt="Report Icon" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/20-ReportIcon.jpg" /><br />
<br />
The resulting page contains the comparison report for the SQL Performance Analyzer task.<br />
<br />
<img alt="Report" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/21-Report.jpg" /><br />
<br />
Clicking on a specific SQL ID displays the statement specific results, along with the before and after execution plans.<br />
<br />
<img alt="SQL Report" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/22-SqlReport.jpg" /><br />
<br />
<a id="optimizer_upgrade_simulation"></a>
<h2>Optimizer Upgrade Simulation</h2>
The SQL Performance Analyzer allows you to test the affects of optimizer version changes on SQL tuning sets. Click the "Optimizer Upgrade Simulation" link on the "SQL Performance Analyzer" page.<br />
<br />
<img alt="Optimizer Upgrade Simulation Link" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/23-OptimizerUpgradeSimulationLink.jpg" /><br />
<br />
Enter a task name, select the two optimizer versions to compare, then click the "Submit" button.<br />
<br />
<img alt="Optimizer Upgrade Simulation" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/24-OptimizerUpgradeSimulation.jpg" /><br />
<br />
The task is listed in the "SQL Performance Analyzer Tasks" section. Refresh the page intermittently until the task status becomes a green tick, then click on the task name.<br />
<br />
<img alt="Task List" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/25-TaskList.jpg" /><br />
<br />
The resulting screen shows details of the selected task. Click on the "Comparison Report" classes icon allows you to view the comparison report.<br />
<br />
<img alt="Task Details" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/26-TaskDetails.jpg" /><br />
<br />
<a id="parameter_change"></a>
<h2>Parameter Change</h2>
The SQL Performance Analyzer provides a shortcut for setting up tests of initialization parameter changes on SQL tuning sets. Click the "Parameter" link on the "SQL Performance Analyzer" page.<br />
<br />
<img alt="Parameter Change Link" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/27-ParameterChangeLink.jpg" /><br />
<br />
Enter a task name and the parameter you wish to test. Enter the base and changed value, then click the "Submit" button.<br />
<br />
<img alt="Parameter Change" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/28-ParameterChange.jpg" /><br />
<br />
The task is listed in the "SQL Performance Analyzer Tasks" section. Refresh the page intermittently until the task status becomes a green tick, then click on the task name.<br />
<br />
<img alt="Task List" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/29-TaskList.jpg" /><br />
<br />
The resulting screen shows details of the selected task. Click on the "Comparison Report" classes icon allows you to view the comparison report.<br />
<br />
<img alt="Task Details" src="http://www.oracle-base.com/articles/11g/images/sql_performance_analyzer/30-TaskDetails.jpg" /><br />
<br />
<a id="transferring_tuning_sets"></a>
<h2>Transferring SQL Tuning Sets</h2>
In the examples listed above, the tests have been performed on the same system. In reality you are more likely to want to create a tuning set on your production system, then run the SQL Performance Analyzer against it on a test system. Fortunately, the <code>DBMS_SQLTUNE</code> package allows you to transport SQL tuning sets by storing them in a staging table.<br />
<br />
First, create the staging table using the <code>CREATE_STGTAB_SQLSET</code> procedure.<br />
<blockquote>
<pre>CONN sys/password@prod AS SYSDBA
BEGIN
DBMS_SQLTUNE.create_stgtab_sqlset(table_name      =&gt; 'SQLSET_TAB',
schema_name     =&gt; 'SPA_TEST_USER',
tablespace_name =&gt; 'USERS');
END;
/</pre>
</blockquote>Next, use the <code>PACK_STGTAB_SQLSET</code> procedure to export SQL tuning set into the staging table.<br />
<blockquote>
<pre>BEGIN
DBMS_SQLTUNE.pack_stgtab_sqlset(sqlset_name          =&gt; 'SPA_TEST_SQLSET',
sqlset_owner         =&gt; 'SYS',
staging_table_name   =&gt; 'SQLSET_TAB',
staging_schema_owner =&gt; 'SPA_TEST_USER');
END;
/</pre>
</blockquote>Once the SQL tuning set is packed into the staging table, the table can be transferred to the test system using Datapump, Export/Import or via a database link. Once on the test system, the SQL tuning set can be imported using the <code>UNPACK_STGTAB_SQLSET</code> procedure.<br />
<blockquote>
<pre>BEGIN
DBMS_SQLTUNE.unpack_stgtab_sqlset(sqlset_name          =&gt; '%',
sqlset_owner         =&gt; 'SYS',
replace              =&gt; TRUE,
staging_table_name   =&gt; 'SQLSET_TAB',
staging_schema_owner =&gt; 'SPA_TEST_USER');
END;
/</pre>
</blockquote>The SQL tuning set can now be used with the SQL Performance Analyzer on the test system.<br />
<br />
For more information see:<br />
<ul>
    <li><a href="http://download.oracle.com/docs/cd/B28359_01/server.111/e12159/spa.htm#RATAD101">SQL Performance Analyzer</a>
    <li><a href="http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_sqlpa.htm">DBMS_SQLPA</a>
    <li><a href="http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_sqltun.htm">DBMS_SQLTUNE</a> </li>
</ul>
<img src ="http://www.blogjava.net/jinfeng_wang/aggbug/299566.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2009-10-24 13:58 <a href="http://www.blogjava.net/jinfeng_wang/archive/2009/10/24/299566.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>oracle11g install dbcontrol</title><link>http://www.blogjava.net/jinfeng_wang/archive/2009/10/20/299111.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Tue, 20 Oct 2009 14:10:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2009/10/20/299111.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/299111.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2009/10/20/299111.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/299111.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/299111.html</trackback:ping><description><![CDATA[<p>1)&nbsp; Command:&nbsp; emca -deconfig dbcontrol db -repos drop</p>
<pre class="jive-pre"><code class="jive-code jive-java">2)
<p>drop user SYSMAN cascade;<br />
drop user MGMT_VIEW cascade;<br />
drop role MGMT_USER;<br />
drop public synonym MGMT_TARGET_BLACKOUTS;<br />
drop public synonym SETEMVIEWUSERCONTEXT;</p>
<p>drop user sysman cascade;<br />
drop public synonym MGMT_ADMIN;<br />
drop public synonym MGMT_AS_ECM_UTIL;<br />
drop public synonym MGMT_AVAILABILITY;<br />
drop public synonym MGMT_COLLECTION_PROPERTIES;<br />
drop public synonym MGMT_CREDENTIAL;<br />
drop public synonym MGMT_CURRENT_AVAILABILITY;<br />
drop public synonym MGMT_CURRENT_METRICS;<br />
drop public synonym MGMT_CURRENT_METRIC_ERRORS;<br />
drop public synonym MGMT_CURRENT_SEVERITY;<br />
drop public synonym MGMT_DELTA;<br />
drop public synonym MGMT_DELTA_ENTRY;<br />
drop public synonym MGMT_DELTA_ENTRY_VALUES;<br />
drop public synonym MGMT_DELTA_IDS;<br />
drop public synonym MGMT_DELTA_ID_VALUES;<br />
drop public synonym MGMT_DELTA_VALUE;<br />
drop public synonym MGMT_DELTA_VALUES;<br />
drop public synonym MGMT_GLOBAL;<br />
drop public synonym MGMT_GUID_ARRAY;<br />
drop public synonym MGMT_GUID_OBJ;<br />
drop public synonym MGMT_IP_TGT_GUID_ARRAY;<br />
drop public synonym MGMT_JOB;<br />
drop public synonym MGMT_JOBS;<br />
drop public synonym MGMT_JOB_EXECPLAN;<br />
drop public synonym MGMT_JOB_EXECUTION;<br />
drop public synonym MGMT_JOB_EXEC_SUMMARY;<br />
drop public synonym MGMT_JOB_OUTPUT;<br />
drop public synonym MGMT_JOB_PARAMETER;<br />
drop public synonym MGMT_JOB_SCHEDULE;<br />
drop public synonym MGMT_JOB_TARGET;<br />
drop public synonym MGMT_LOG;<br />
drop public synonym MGMT_LONG_TEXT;<br />
drop public synonym MGMT_MESSAGES;<br />
drop public synonym MGMT_METRICS;drop public synonym MGMT_METRICS_1DAY;<br />
drop public synonym MGMT_METRICS_1HOUR;<br />
drop public synonym MGMT_METRICS_COMPOSITE_KEYS;<br />
drop public synonym MGMT_METRICS_RAW;<br />
drop public synonym MGMT_METRIC_COLLECTIONS;<br />
drop public synonym MGMT_METRIC_ERRORS;<br />
drop public synonym MGMT_METRIC_THRESHOLDS;<br />
drop public synonym MGMT_NAME_VALUE;<br />
drop public synonym MGMT_NAME_VALUES;<br />
drop public synonym MGMT_PREFERENCES;<br />
drop public synonym MGMT_SEVERITY;<br />
drop public synonym MGMT_SEVERITY_ARRAY;<br />
drop public synonym MGMT_SEVERITY_OBJ;<br />
drop public synonym MGMT_STRING_METRIC_HISTORY;<br />
drop public synonym MGMT_TARGET;<br />
drop public synonym MGMT_TARGETS;<br />
drop public synonym MGMT_TARGET_BLACKOUTS;<br />
drop public synonym MGMT_TARGET_MEMBERSHIPS;<br />
drop public synonym MGMT_TARGET_PROPERTIES;<br />
drop public synonym MGMT_TYPE_PROPERTIES;<br />
drop public synonym MGMT_USER;<br />
drop public synonym MGMT_VIEW_UTIL;<br />
drop public synonym MGMT$DELTA_ORACLE_HOME;<br />
drop public synonym MGMT$DELTA_OS_COMPONENTS;<br />
drop public synonym MGMT$DELTA_OS_COMP_DETAILS;<br />
drop public synonym MGMT$DELTA_OS_KERNEL_PARAMS;<br />
drop public synonym MGMT$DELTA_PATCHSETS;<br />
drop public synonym MGMT$DELTA_PATCHSET_DETAILS;<br />
drop public synonym MGMT$DELTA_TABLESPACES;<br />
drop public synonym MGMT$DELTA_VENDOR_SW;<br />
drop public synonym MGMT$DELTA_VIEW;<br />
drop public synonym MGMT$DELTA_VIEW_DETAILS;<br />
drop public synonym MGMT$ECM_CURRENT_SNAPSHOTS;<br />
drop public synonym MGMT$ECM_VISIBLE_SNAPSHOTS;<br />
drop public synonym MGMT$GROUP_DERIVED_MEMBERSHIPS;<br />
drop public synonym MGMT$GROUP_FLAT_MEMBERSHIPS;<br />
drop public synonym MGMT$GROUP_MEMBERS;<br />
drop public synonym MGMT$HA_BACKUP;<br />
drop public synonym MGMT$HA_FILES;<br />
drop public synonym MGMT$HA_INFO;<br />
drop public synonym MGMT$HA_INIT_PARAMS;<br />
drop public synonym MGMT$HA_MTTR;<br />
drop public synonym MGMT$HA_RMAN_CONFIG;<br />
drop public synonym MGMT$HW_NIC;<br />
drop public synonym MGMT$METRIC_COLLECTION;<br />
drop public synonym MGMT$METRIC_CURRENT;<br />
drop public synonym MGMT$METRIC_DAILY;<br />
drop public synonym MGMT$METRIC_DETAILS;<br />
drop public synonym MGMT$METRIC_HOURLY;<br />
drop public synonym MGMT$MISSING_TARGETS;<br />
drop public synonym MGMT$MISSING_TARGETS_IN_GROUPS;<br />
drop public synonym MGMT$OS_COMPONENTS;<br />
drop public synonym MGMT$OS_FS_MOUNT;<br />
drop public synonym MGMT$OS_HW_SUMMARY;<br />
drop public synonym MGMT$OS_KERNEL_PARAMS;<br />
drop public synonym MGMT$OS_PATCHES;<br />
drop public synonym MGMT$OS_SUMMARY;<br />
drop public synonym MGMT$SOFTWARE_COMPONENTS;<br />
drop public synonym MGMT$SOFTWARE_COMPONENT_ONEOFF;<br />
drop public synonym MGMT$SOFTWARE_COMP_PATCHSET;<br />
drop public synonym MGMT$SOFTWARE_DEPENDENCIES;<br />
drop public synonym MGMT$SOFTWARE_HOMES;<br />
drop public synonym MGMT$SOFTWARE_ONEOFF_PATCHES;<br />
drop public synonym MGMT$SOFTWARE_OTHERS;<br />
drop public synonym MGMT$SOFTWARE_PATCHES_IN_HOMES;<br />
drop public synonym MGMT$SOFTWARE_PATCHSETS;<br />
drop public synonym MGMT$TARGET;<br />
drop public synonym MGMT$TARGET_COMPONENTS;<br />
drop public synonym MGMT$TARGET_COMPOSITE;<br />
drop public synonym MGMT$TARGET_PROPERTIES;<br />
drop public synonym MGMT$TARGET_TYPE;<br />
drop PUBLIC SYNONYM SMP_EMD_AVAIL_OBJ;<br />
drop public synonym EMD_MNTR;<br />
drop public synonym SMP_EMD_AVAIL_OBJ;<br />
drop public synonym SMP_EMD_DELETE_REC_ARRAY;<br />
drop public synonym SMP_EMD_INTEGER_ARRAY;<br />
drop public synonym SMP_EMD_INTEGER_ARRAY_ARRAY;<br />
drop public synonym SMP_EMD_NVPAIR;<br />
drop public synonym SMP_EMD_NVPAIR_ARRAY;<br />
drop public synonym SMP_EMD_STRING_ARRAY;<br />
drop public synonym SMP_EMD_STRING_ARRAY_ARRAY;<br />
drop public synonym SMP_EMD_TARGET_OBJ;<br />
drop public synonym SMP_EMD_TARGET_OBJ_ARRAY;<br />
drop public synonym ECM_UTIL;<br />
drop role mgmt_user;</p>
<p><br />
DROP USER sysman CASCADE;<br />
DROP USER mgmt_view CASCADE;<br />
DROP ROLE MGMT_USER;<br />
ALTER USER dbsnmp ACCOUNT UNLOCK;<br />
ALTER USER dbsnmp identified by dbsnmp;<br />
DROP PUBLIC SYNONYM SETEMVIEWUSERCONTEXT;<br />
DROP PUBLIC SYNONYM MGMT_TARGET_BLACKOUTS;<br />
DROP PUBLIC SYNONYM MGMT_AVAILABILITY;<br />
DROP PUBLIC SYNONYM MGMT_CURRENT_AVAILABILITY;<br />
DROP PUBLIC SYNONYM MGMT_SEVERITY_OBJ;<br />
DROP PUBLIC SYNONYM MGMT_SEVERITY_ARRAY;<br />
DROP PUBLIC SYNONYM MGMT_GUID_OBJ; <br />
DROP PUBLIC SYNONYM MGMT_GUID_ARRAY;<br />
DROP PUBLIC SYNONYM SMP_EMD_AVAIL_OBJ;<br />
DROP PUBLIC SYNONYM SMP_EMD_TARGET_OBJ;<br />
DROP PUBLIC SYNONYM SMP_EMD_TARGET_OBJ_ARRAY;<br />
DROP PUBLIC SYNONYM SMP_EMD_DELETE_REC_ARRAY;<br />
DROP PUBLIC SYNONYM MGMT_METRICS;<br />
DROP PUBLIC SYNONYM MGMT_TARGETS;<br />
DROP PUBLIC SYNONYM MGMT_TYPE_PROPERTIES;<br />
DROP PUBLIC SYNONYM MGMT_TARGET_PROPERTIES; <br />
DROP PUBLIC SYNONYM MGMT_METRICS_RAW; <br />
DROP PUBLIC SYNONYM MGMT_CURRENT_METRICS; <br />
DROP PUBLIC SYNONYM MGMT_STRING_METRIC_HISTORY; <br />
DROP PUBLIC SYNONYM MGMT_LONG_TEXT; <br />
DROP PUBLIC SYNONYM MGMT_METRICS_COMPOSITE_KEYS; <br />
DROP PUBLIC SYNONYM MGMT_METRICS_1HOUR; <br />
DROP PUBLIC SYNONYM MGMT_METRICS_1DAY; <br />
DROP PUBLIC SYNONYM MGMT_METRIC_ERRORS; <br />
DROP PUBLIC SYNONYM MGMT_CURRENT_METRIC_ERRORS; <br />
DROP PUBLIC SYNONYM EMD_MNTR; <br />
DROP PUBLIC SYNONYM MGMT_METRIC_COLLECTIONS; <br />
DROP PUBLIC SYNONYM MGMT_COLLECTION_PROPERTIES ; <br />
DROP PUBLIC SYNONYM MGMT_METRIC_THRESHOLDS; <br />
DROP PUBLIC SYNONYM SMP_EMD_NVPAIR; <br />
DROP PUBLIC SYNONYM SMP_EMD_NVPAIR_ARRAY; <br />
DROP PUBLIC SYNONYM SMP_EMD_STRING_ARRAY;<br />
DROP PUBLIC SYNONYM SMP_EMD_STRING_ARRAY_ARRAY;<br />
DROP PUBLIC SYNONYM SMP_EMD_INTEGER_ARRAY;<br />
DROP PUBLIC SYNONYM SMP_EMD_INTEGER_ARRAY_ARRAY;<br />
DROP PUBLIC SYNONYM MGMT_DELTA_IDS;<br />
DROP PUBLIC SYNONYM MGMT_DELTA_ID_VALUES;<br />
DROP PUBLIC SYNONYM MGMT_DELTA_ENTRY;<br />
DROP PUBLIC SYNONYM MGMT_DELTA_ENTRY_VALUES;<br />
DROP PUBLIC SYNONYM MGMT_DELTA_VALUE;<br />
DROP PUBLIC SYNONYM MGMT_DELTA_VALUES;<br />
DROP PUBLIC SYNONYM MGMT_NAME_VALUE;<br />
DROP PUBLIC SYNONYM MGMT_NAME_VALUES;<br />
DROP PUBLIC SYNONYM ECM_UTIL;</p>
<p>DROP PUBLIC SYNONYM MGMT_DELTA;<br />
DROP PUBLIC SYNONYM MGMT_TARGET_MEMBERSHIPS;<br />
DROP PUBLIC SYNONYM MGMT_JOB;<br />
DROP PUBLIC SYNONYM MGMT_JOB_PARAMETER;<br />
DROP PUBLIC SYNONYM MGMT_JOB_TARGET;<br />
DROP PUBLIC SYNONYM MGMT_JOB_SCHEDULE;<br />
DROP PUBLIC SYNONYM MGMT_JOB_EXECPLAN;<br />
DROP PUBLIC SYNONYM MGMT_JOB_EXEC_SUMMARY;<br />
DROP PUBLIC SYNONYM MGMT_JOB_OUTPUT;<br />
DROP PUBLIC SYNONYM MGMT_JOB_EXECUTION;<br />
DROP PUBLIC SYNONYM MGMT_LOG;<br />
DROP PUBLIC SYNONYM MGMT_ADMIN;<br />
DROP PUBLIC SYNONYM MGMT_GLOBAL;<br />
DROP PUBLIC SYNONYM MGMT_TARGET;<br />
DROP PUBLIC SYNONYM MGMT_CREDENTIAL;<br />
DROP PUBLIC SYNONYM MGMT_JOBS;<br />
DROP PUBLIC SYNONYM MGMT_PREFERENCES;<br />
DROP PUBLIC SYNONYM MGMT_USER;<br />
DROP PUBLIC SYNONYM MGMT_SEVERITY;<br />
DROP PUBLIC SYNONYM MGMT_CURRENT_SEVERITY;<br />
DROP PUBLIC SYNONYM MGMT_PAF_PROCS_LATEST;<br />
DROP PUBLIC SYNONYM MGMT_PAF_JOBS;<br />
DROP PUBLIC SYNONYM MGMT_PAF$PROCEDURES;<br />
DROP PUBLIC SYNONYM MGMT_PAF$INSTANCES;<br />
DROP PUBLIC SYNONYM MGMT_PAF$STATES;<br />
DROP PUBLIC SYNONYM MGMT_PAF$APPLICATIONS;<br />
DROP PUBLIC SYNONYM MGMT_VIEW_UTIL;<br />
DROP PUBLIC SYNONYM MGMT_MESSAGES;</p>
3)create:<br />
Command: emca -config dbcontrol db -repos create</code></pre>
<img src ="http://www.blogjava.net/jinfeng_wang/aggbug/299111.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2009-10-20 22:10 <a href="http://www.blogjava.net/jinfeng_wang/archive/2009/10/20/299111.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>启动Oracle</title><link>http://www.blogjava.net/jinfeng_wang/archive/2009/10/19/298889.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Mon, 19 Oct 2009 12:33:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2009/10/19/298889.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/298889.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2009/10/19/298889.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/298889.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/298889.html</trackback:ping><description><![CDATA[启动实例装载并打开数据库： STARTUP<br />
<br />
启动实例不装载数据库：STARTUP NOMOUNT<br />
在下面的任务中必须装载数据库而不用打开数据库<br />
􀁺􀀃 重命名数据文件<br />
􀁺􀀃 添加取消或重命名重做日志文件<br />
􀁺􀀃 允许和禁止重做日志存档选项<br />
􀁺􀀃 执行完整的数据库恢复操作<br />
<br />
<br />
<br />
启动实例并装载数据库：STARTUP MOUNT<br />
当需要完成以下一种任务时使用这种数据库启动模式：<br />
􀁺􀀃 执行数据库数据的导出或导入操作<br />
􀁺􀀃 执行数据装载操作用SQL*Loader<br />
􀁺􀀃 暂时阻止一般的用户使用数据<br />
􀁺􀀃 在某个移植过程和升级操作过程中<br />
<br />
<br />
<br />
为实例装载数据库：ALTER DATABASE MOUNT<br />
<br />
打开一个关闭的数据库：ALTER DATABASE OPEN<br />
<br />
以只读模式打开数据库：ALTER DATABASE OPEN READ ONLY;
<img src ="http://www.blogjava.net/jinfeng_wang/aggbug/298889.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2009-10-19 20:33 <a href="http://www.blogjava.net/jinfeng_wang/archive/2009/10/19/298889.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>