<?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>Sybase数据库技术，数据库恢复专家 &#187; sp_indsuspect</title>
	<atom:link href="http://www.dbainfo.net/tag/sp_indsuspect/feed" rel="self" type="application/rss+xml" />
	<link>https://www.dbainfo.net</link>
	<description>提供Sybase ASE及Sybase SQL Anywhere数据库修复服务，电话：13811580958(微信)，QQ：289965371！We have many years of experience in recovering data from damanged Sybase devices. Contact us by Phone: +86 13811580958 Wechat: 13811580958 Email: 289965371@qq.com</description>
	<lastBuildDate>Sat, 14 Jun 2025 16:28:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>查找并修复损坏的索引</title>
		<link>https://www.dbainfo.net/find_suspect_index.htm</link>
		<comments>https://www.dbainfo.net/find_suspect_index.htm#comments</comments>
		<pubDate>Tue, 24 Jun 2014 07:12:37 +0000</pubDate>
		<dc:creator>dbainfo</dc:creator>
				<category><![CDATA[Sybase ASE]]></category>
		<category><![CDATA[sp_indsuspect]]></category>

		<guid isPermaLink="false">http://www.dbainfo.net/?p=2493</guid>
		<description><![CDATA[ASE将索引标记为&#8220;可疑&#8221;时，或者ASE的排序顺修改后，索引状态会设置：-32768， patrol指标SuspectIndex会监控数据库中可疑索引的个数。 &#160; 查找出现索引索引损坏的表： 存储过程：sp_indsuspect [table_name] &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 如果不加表名，就是查找当前数据库中因排序顺序更改需被重建的索引的所有表； 或： select u.name as user_name, o.name as table_name, i.name as index_name,i.status from&#160; sysobjects o,&#160; sysindexes i,&#160; sysusers u where&#160;&#160; o.id = i.id&#160;&#160; and o.uid = u.uid &#160; --and o.id = object_id(&#39;table_name&#39;) &#160; and (i.status &#38; -32768) != 0 例子： 1&#62; sp_indsuspect 2&#62; go Suspect indexes in database [...]]]></description>
			<content:encoded><![CDATA[<p>ASE将索引标记为&ldquo;可疑&rdquo;时，或者ASE的排序顺修改后，索引状态会设置：-32768，</p>
<p>patrol指标SuspectIndex会监控数据库中可疑索引的个数。</p>
<p>&nbsp;</p>
<p><strong>查找出现索引索引损坏的表：<br />
	</strong></p>
<p>存储过程：sp_indsuspect [table_name]</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 如果不加表名，就是查找当前数据库中因排序顺序更改需被重建的索引的所有表；</p>
<p>或：</p>
<p>select u.name as user_name, o.name as table_name, i.name as index_name,i.status<br />
	from&nbsp; sysobjects o,&nbsp; sysindexes i,&nbsp; sysusers u<br />
	where&nbsp;&nbsp; o.id = i.id&nbsp;&nbsp; and o.uid = u.uid<br />
	&nbsp; --and o.id = object_id(&#39;table_name&#39;)<br />
	&nbsp; and (i.status &amp; -32768) != 0</p>
<p><strong>例子：<br />
	</strong></p>
<p>1&gt; sp_indsuspect<br />
	2&gt; go<br />
	Suspect indexes in database dbainfo:<br />
	&nbsp;Own.Tab.Ind (Obj_ID, Ind_ID)<br />
	&nbsp;----------------------------------------------<br />
	&nbsp;dbo.sysqueryplans.csysqueryplans (27, 2)<br />
	&nbsp;dbo.sysqueryplans.ncsysqueryplans (27, 3)</p>
<p>&nbsp;</p>
<p><strong>修复索引：</strong></p>
<p>建议使用dbcc reindex ({table_name | table_id})</p>
<p>当dbcc reindex发现损坏的索引时，它会删除并重新创建相应的索引。dbcc reindex不会重建系统表的索引。</p>
<p>生成重建用户表索引命令的SQL语句：</p>
<p>select distinct &#39;dbcc reindex(&#39;&#39;&#39;|| u.name || &#39;.&#39; ||&nbsp; o.name&nbsp; || &#39;&#39;&#39;)&#39;<br />
	from&nbsp; sysobjects o,&nbsp; sysindexes i,&nbsp; sysusers u<br />
	where&nbsp;&nbsp; o.id = i.id&nbsp;&nbsp; and o.uid = u.uid<br />
	&nbsp; --and o.id = object_id(&#39;table_name&#39;)<br />
	&nbsp; and (i.status &amp; -32768) != 0</p>
<p>&nbsp;</p>
<p><strong>索引重建时间：<br />
	</strong></p>
<p>系统表sysindexes中有字段crdate记录索引的创建时间。使用dbcc reindex重建索引后，可以通过查询sysindexes.crdate来确认索引的创建时间。</p>
<p>select object_name(id),indid,name,crdate from sysindexes</p>
<p>&nbsp;</p>
<p><strong>另外修复索引的方法：<br />
	</strong></p>
<p>1、保存索引的创建语法，手动删除索引后再创建索引；</p>
<p>2、reorg rebuild table_name index_name<br />
	&nbsp;</p>
<div style="clear: both; margin: 10px 0pt; border: 1px dashed rgb(153, 153, 153); font-size: 12px; padding: 5px 10px;">
<li>本文链接地址：<a href="https://www.dbainfo.net/find_suspect_index.htm">https://www.dbainfo.net/find_suspect_index.htm</a>；</li>
<li>本文为dbainfo个人原创，请在尊重作者劳动成果的前提下进行转载；</li>
<li>转载务必注明原始出处 : <a href="https://www.dbainfo.net/">Sybase数据库技术，数据库恢复专家</a>；</li>
<li>对《<a href="https://www.dbainfo.net/find_suspect_index.htm">查找并修复损坏的索引</a>》有何疑问或见解，请在本文下方发表；</li>
<li>对网站还有其他问题或建议，请提交在<a href="https://www.dbainfo.net/messages" target="_blank">留言板</a>，谢谢！</li>
</div>
<h2  class="related_post_title">随机日志</h2><ul class="related_post"><li>2010-06-01 -- <a href="https://www.dbainfo.net/sybase-iq15-1-license-out-of-time-grace-period.htm" title="关于Sybase IQ15.1试用版到期后继续试用的问题解决">关于Sybase IQ15.1试用版到期后继续试用的问题解决</a> (0)</li><li>2015-03-07 -- <a href="https://www.dbainfo.net/sap-sdk-cr-number.htm" title="SAP SDK的所有已知BUG列表">SAP SDK的所有已知BUG列表</a> (0)</li><li>2010-04-24 -- <a href="https://www.dbainfo.net/view-ase-non-default-configure-parameters.htm" title="如何查看ASE的非缺省配置参数">如何查看ASE的非缺省配置参数</a> (1)</li><li>2010-09-15 -- <a href="https://www.dbainfo.net/java-hello-world.htm" title="初学Java，从HelloWorld开始">初学Java，从HelloWorld开始</a> (0)</li><li>2013-05-23 -- <a href="https://www.dbainfo.net/rename-sybase-ase-servername.htm" title="修改ASE的服务器名称">修改ASE的服务器名称</a> (0)</li><li>2015-03-08 -- <a href="https://www.dbainfo.net/sap-asa-cr-number-3.htm" title="SAP SQL Anywhere的所有已知BUG列表（3）">SAP SQL Anywhere的所有已知BUG列表（3）</a> (0)</li><li>2009-12-28 -- <a href="https://www.dbainfo.net/securecrt-display-problem.htm" title="Secure CRT 乱码问题解决">Secure CRT 乱码问题解决</a> (0)</li><li>2012-03-29 -- <a href="https://www.dbainfo.net/sybase-ase-null-is-null.htm" title="Sybase ASE 中null is null的处理结果是什么？">Sybase ASE 中null is null的处理结果是什么？</a> (0)</li><li>2010-02-22 -- <a href="https://www.dbainfo.net/sql-server-patch-version-mapping-table.htm" title="SQL Server补丁版本的检查[转]">SQL Server补丁版本的检查[转]</a> (0)</li><li>2012-11-10 -- <a href="https://www.dbainfo.net/sybase-ase-15-0-3-test-server.htm" title="免费提供Sybase ASE v15.0.3试用测试服务器环境">免费提供Sybase ASE v15.0.3试用测试服务器环境</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>https://www.dbainfo.net/find_suspect_index.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
