<?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; index</title>
	<atom:link href="http://www.ochef.net/tag/index/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ochef.net</link>
	<description>Oracle and My Life</description>
	<lastBuildDate>Mon, 09 Jan 2012 05:39:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How create index on big table</title>
		<link>http://www.ochef.net/2009/03/how-create-index-on-big-table.html</link>
		<comments>http://www.ochef.net/2009/03/how-create-index-on-big-table.html#comments</comments>
		<pubDate>Wed, 18 Mar 2009 08:45:23 +0000</pubDate>
		<dc:creator>ochef</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://www.ochef.net/?p=219</guid>
		<description><![CDATA[要在一个业务繁忙的OLTP环境下对一个拥有上千万数据的大表创建索引，一个原则就是根据主机CPU的数量尽可能的让SQL进行并行处理（paralell），同时尽量少产生redo。在创建索引之前需要把sort_area_size排序区修改得大一点，如下： SQL&#62;alter SESSION SET workarea_size_policy=manual; SQL&#62;alter SESSION SET sort_area_size=1024m; 并行执行SQL：（注意TEMP tablespace的大小，如果太小需要适当的加大） 1 2 SQL&#62;create UNIQUE INDEX index_name ON tablename&#40;column_name&#41; online nologging parallel 2 compute statistics; 索引创建完成之后注意要取消并行： SQL&#62;alter INDEX index_name noparallel;<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2009%2F04%2Foracle-buys-sun.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F03%2Fhow-create-index-on-big-table.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Oracle Buys Sun</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2009%2F09%2Fdb2_vs_oracle_01.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F03%2Fhow-create-index-on-big-table.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">DB2对比Oracle学习系列之:instance &amp; database concepts</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2009%2F03%2Finstall-oracle-102-on-solaris10.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F03%2Fhow-create-index-on-big-table.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Install oracle 10.2 on Solaris10</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2009%2F03%2Fstop-and-remove-oracle-advanced-replication.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F03%2Fhow-create-index-on-big-table.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Stop and remove oracle advanced replication</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>要在一个业务繁忙的OLTP环境下对一个拥有上千万数据的大表创建索引，一个原则就是根据主机CPU的数量尽可能的让SQL进行并行处理（paralell），同时尽量少产生redo。在创建索引之前需要把sort_area_size排序区修改得大一点，如下：</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">SQL<span style="color: #66cc66;">&gt;</span>alter <span style="color: #993333; font-weight: bold;">SESSION</span> <span style="color: #993333; font-weight: bold;">SET</span> workarea_size_policy<span style="color: #66cc66;">=</span>manual;
SQL<span style="color: #66cc66;">&gt;</span>alter <span style="color: #993333; font-weight: bold;">SESSION</span> <span style="color: #993333; font-weight: bold;">SET</span> sort_area_size<span style="color: #66cc66;">=</span>1024m;</pre></div></div>

<p>并行执行SQL：（注意TEMP tablespace的大小，如果太小需要适当的加大）</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;">SQL<span style="color: #66cc66;">&gt;</span>create <span style="color: #993333; font-weight: bold;">UNIQUE</span> <span style="color: #993333; font-weight: bold;">INDEX</span> index_name <span style="color: #993333; font-weight: bold;">ON</span> tablename<span style="color: #66cc66;">&#40;</span>column_name<span style="color: #66cc66;">&#41;</span>
      online nologging parallel <span style="color: #cc66cc;">2</span> compute statistics;</pre></td></tr></table></div>

<p>索引创建完成之后注意要取消并行：</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">SQL<span style="color: #66cc66;">&gt;</span>alter <span style="color: #993333; font-weight: bold;">INDEX</span> index_name noparallel;</pre></div></div>

<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2009%2F04%2Foracle-buys-sun.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F03%2Fhow-create-index-on-big-table.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Oracle Buys Sun</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2009%2F09%2Fdb2_vs_oracle_01.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F03%2Fhow-create-index-on-big-table.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">DB2对比Oracle学习系列之:instance &amp; database concepts</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2009%2F03%2Finstall-oracle-102-on-solaris10.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F03%2Fhow-create-index-on-big-table.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Install oracle 10.2 on Solaris10</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2009%2F03%2Fstop-and-remove-oracle-advanced-replication.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F03%2Fhow-create-index-on-big-table.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Stop and remove oracle advanced replication</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.ochef.net/2009/03/how-create-index-on-big-table.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

