<?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-01-16 -- <a href="https://www.dbainfo.net/one-way-to-recover-master-configuration-area.htm" title="master数据库配置区域(configuration area)损坏的一种修复方法">master数据库配置区域(configuration area)损坏的一种修复方法</a> (1)</li><li>2010-11-10 -- <a href="https://www.dbainfo.net/database-operation-by-sybase-central.htm" title="利用Sybase Central简单操作Sybase ASE数据库">利用Sybase Central简单操作Sybase ASE数据库</a> (4)</li><li>2010-08-09 -- <a href="https://www.dbainfo.net/sqlserver2008-backup-database-with-compression-options.htm" title="sql server 2008中的备份压缩特性">sql server 2008中的备份压缩特性</a> (0)</li><li>2011-09-02 -- <a href="https://www.dbainfo.net/grep-some-characters-by-linux-sed.htm" title="使用sed提取指定内容的一种写法">使用sed提取指定内容的一种写法</a> (5)</li><li>2012-04-11 -- <a href="https://www.dbainfo.net/ase-alter-table-modify-column-default-value.htm" title="ASE修改列的默认值属性">ASE修改列的默认值属性</a> (0)</li><li>2015-09-02 -- <a href="https://www.dbainfo.net/sap-ase-manual-index2.htm" title="SAP ASE 15.7 ESD#2中文版官方手册目录列表（2）">SAP ASE 15.7 ESD#2中文版官方手册目录列表（2）</a> (0)</li><li>2010-11-10 -- <a href="https://www.dbainfo.net/sybase-central-export-import-table-data.htm" title="利用Sybase Central 导出与导入表内数据">利用Sybase Central 导出与导入表内数据</a> (0)</li><li>2014-12-20 -- <a href="https://www.dbainfo.net/iq_certifications.htm" title="Sybase IQ各版本认证情况">Sybase IQ各版本认证情况</a> (0)</li><li>2014-12-09 -- <a href="https://www.dbainfo.net/delete-duplicate-row-by-ignore_dup_row_option.htm" title="ASE使用with ignore_dup_row删除重复数据">ASE使用with ignore_dup_row删除重复数据</a> (1)</li><li>2010-12-20 -- <a href="https://www.dbainfo.net/ase-character-set-support-simplified-chinese.htm" title="Sybae ASE中支持简体中文的字符集">Sybae ASE中支持简体中文的字符集</a> (2)</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>
