<?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; move lob</title>
	<atom:link href="https://www.xifenfei.com/tag/move-lob/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>Wed, 04 Nov 2026 15:33:30 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>move lob导致index失效</title>
		<link>https://www.xifenfei.com/2017/11/move-lob-index-unusable.html</link>
		<comments>https://www.xifenfei.com/2017/11/move-lob-index-unusable.html#comments</comments>
		<pubDate>Wed, 22 Nov 2017 02:36:11 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[index UNUSABLE]]></category>
		<category><![CDATA[move lob]]></category>
		<category><![CDATA[ORA-01502]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=7246</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2017/11/move-lob-index-unusable.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/11/move-lob-index-unusable.html" target="_blank">move lob导致index失效</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>在一次数据库升级过程中,因为blug需要move lob，导致表相关index失效,这里通过实验重现<br />
<strong>数据库版本</strong></p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0      Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
</pre>
<p><strong>创建用户</strong></p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; create user xff identified by oracle;

User created.

SQL&gt; grant dba to xff;

Grant succeeded.
</pre>
<p><strong>创建测试表和插入数据</strong></p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; conn xff/oracle
Connected.

SQL&gt; create table t_xff (id int primary key not null,name varchar2(20),c_lob clob);

Table created.

SQL&gt; insert into t_xff values(1,'www.xifenfei.com','//www.xifenfei.com');

1 row created.

SQL&gt;  insert into t_xff values(2,'www.xifenfei.com','//www.xifenfei.com');

1 row created.

SQL&gt; commit;

Commit complete.

SQL&gt; select index_name,status from user_indexes;

INDEX_NAME                     STATUS
------------------------------ --------
SYS_IL0000090094C00003$$       VALID
SYS_C0011148                   VALID
</pre>
<p><strong>move lob</strong></p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; ALTER TABLE t_xff MOVE LOB (c_lob) store as (tablespace users);

Table altered.

SQL&gt;  select index_name,status from user_indexes;

INDEX_NAME                     STATUS
------------------------------ --------
SYS_IL0000090094C00003$$       VALID
SYS_C0011148                   UNUSABLE

SQL&gt;  insert into t_xff values(3,'www.xifenfei.com','//www.xifenfei.com');
 insert into t_xff values(3,'www.xifenfei.com','//www.xifenfei.com')
*
ERROR at line 1:
ORA-01502: index 'XFF.SYS_C0011148' or partition of such index is in unusable
state
</pre>
<p>这里很明显，当我们move lob之后，表的index变为无效,插入操作无法进行<br />
<br />
<strong>rebuind index</strong></p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; alter index xff.SYS_C0011148 rebuild;

Index altered.

SQL&gt; select index_name,status from user_indexes;

INDEX_NAME                     STATUS
------------------------------ --------
SYS_IL0000090094C00003$$       VALID
SYS_C0011148                   VALID

SQL&gt; insert into t_xff values(3,'www.xifenfei.com','//www.xifenfei.com');

1 row created.

SQL&gt; commit;

Commit complete.
</pre>
<p>这个测试就是告诫自己,做oracle 不要想当然，move lob之后，表相关的index 都会失效，需要rebuild。具体参见:<br />
Bug 6525073 : STBH: INDEX IS IN UNUSABLE STATE AFTER A LOB COLUMN IS MOVED<br />
ALTER TABLE MOVE LOB makes indexes unusable on the parent table (Doc ID 1228324.1)</p>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/12/some-indexes-or-index-subpartitions-of-table-vas-tab_pub_calllog-have-been-marked-unusable.html" rel="bookmark" class="crp_title">Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/04/oracle_rowid%e5%88%86%e6%9e%90.html" rel="bookmark" class="crp_title">ORACLE ROWID 分析</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/03/%e9%80%9a%e8%bf%87%e4%bf%ae%e6%94%b9col-col%e6%94%b9%e5%8f%98%e5%88%97%e5%b1%95%e7%a4%ba%e9%a1%ba%e5%ba%8f.html" rel="bookmark" class="crp_title">通过修改col$.col#改变列展示顺序</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/12/ora-1502%e9%97%ae%e9%a2%98%e5%88%86%e6%9e%90%e8%a7%a3%e5%86%b3.html" rel="bookmark" class="crp_title">ORA-1502问题分析解决</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/01/oracle-user-read-only.html" rel="bookmark" class="crp_title">Oracle read only用户&#8212;23ai新特性:只读用户</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2013/04/12c-%e4%bd%bf%e7%94%a8sequence%e4%bd%9c%e4%b8%ba%e5%88%97%e9%bb%98%e8%ae%a4%e5%80%bc.html" rel="bookmark" class="crp_title">12c 使用sequence作为列默认值</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/12/orcle-12c-%e5%a2%9e%e5%8a%a0%e5%88%97%e6%97%a0%e9%bb%98%e8%ae%a4%e5%80%bc.html" rel="bookmark" class="crp_title">ORCLE 12C 增加列,无默认值</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/12/%e5%85%b3%e4%ba%8eaud%e5%af%b9%e8%b1%a1%e7%9b%b8%e5%85%b3%e5%a4%84%e7%90%86.html" rel="bookmark" class="crp_title">关于aud$对象相关处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/03/multiple-table-cache-group%e9%85%8d%e7%bd%ae.html" rel="bookmark" class="crp_title">Multiple-table cache group配置</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/03/%e6%8e%88%e6%9d%83%e7%94%a8%e6%88%b7%e8%ae%bf%e9%97%ae%e6%95%b0%e6%8d%ae%e5%ad%97%e5%85%b8%e4%b8%89%e7%a7%8d%e6%96%b9%e5%bc%8f.html" rel="bookmark" class="crp_title">授权用户访问数据字典三种方式</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/06/deferred_segment_creation-%e5%8f%82%e6%95%b0%e7%9b%b8%e5%85%b3%e8%af%b4%e6%98%8e.html" rel="bookmark" class="crp_title">DEFERRED_SEGMENT_CREATION 参数相关说明</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2024/02/dml-redirection.html" rel="bookmark" class="crp_title">Oracle 19C 备库DML重定向&#8212;DML Redirection</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2017/11/move-lob-index-unusable.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
