<?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>2015-03-07 -- <a href="https://www.dbainfo.net/sap-rs-cr-number-1.htm" title="SAP Replication Server的所有已知BUG列表（1）">SAP Replication Server的所有已知BUG列表（1）</a> (0)</li><li>2010-09-16 -- <a href="https://www.dbainfo.net/java-connect-to-sqlserver-demo.htm" title="Java连接SQL Server数据库的一个简单例子">Java连接SQL Server数据库的一个简单例子</a> (0)</li><li>2020-08-02 -- <a href="https://www.dbainfo.net/ase-16-0-can-not-connect-an-illegal-length-was-received.htm" title="Sybase ASE 16.0数据库无法连接报错There is a protocol packet error. An illegal length was received">Sybase ASE 16.0数据库无法连接报错There is a protocol packet error. An illegal length was received</a> (0)</li><li>2011-10-19 -- <a href="https://www.dbainfo.net/install-ase15-7-glibc-detected-srvbuildres-free-invalid-pointer.htm" title="安装ASE15.7时出现glibc detected *** srvbuildres: free(): invalid pointer问题的解决">安装ASE15.7时出现glibc detected *** srvbuildres: free(): invalid pointer问题的解决</a> (3)</li><li>2010-10-19 -- <a href="https://www.dbainfo.net/database-backup-strategy-delete-n-days-ago-files-for.htm" title="数据库备份策略中删除N天前的备份文件">数据库备份策略中删除N天前的备份文件</a> (0)</li><li>2011-01-24 -- <a href="https://www.dbainfo.net/ase_db_extend_increase_stack_size_.htm" title="添加自动扩展时调整stack size的大小">添加自动扩展时调整stack size的大小</a> (0)</li><li>2010-06-07 -- <a href="https://www.dbainfo.net/ase-database-device-disk-mirror-and-disk-unmirror.htm" title="使用ASE15.x数据库中的设备镜像功能">使用ASE15.x数据库中的设备镜像功能</a> (0)</li><li>2014-10-10 -- <a href="https://www.dbainfo.net/ase-object-name-length-limit.htm" title="ASE对象名称长度限制">ASE对象名称长度限制</a> (0)</li><li>2010-11-10 -- <a href="https://www.dbainfo.net/manage-sybase-ase-servername-by-directory-service-editor.htm" title="利用目录服务编辑器dsedit管理ASE的服务器名称">利用目录服务编辑器dsedit管理ASE的服务器名称</a> (0)</li><li>2011-09-19 -- <a href="https://www.dbainfo.net/aix-fail-to-create-install-of-aio.htm" title="AIX上未启动异步IO导致Sybase服务创建失败">AIX上未启动异步IO导致Sybase服务创建失败</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>
