用isql登录数据库,查看一下object_id:1792006384是哪张表,这张表的哪个索引坏了?
通过select object_name(1792006384)查询出来表名为:js_keys
查询表js_keys内数据的时候,报索引损坏的错误:
1> select count(*) from js_keys
2> go
Index id 2 on table id 1792006384 cannot be used in the optimization of a query
as it is SUSPECT. Please have the SA run DBCC REINDEX on the specified table.
-----------
5
(1 row affected)
通过上面给出的提示信息,可以看出表js_keys的indid=2的索引坏了。需要重建该表的索引。
使用reindex命令来修复表js_keys的损坏的索引:
dbcc traceon(3604)
go
dbcc reindex(js_keys)
go
反馈信息为:
1> dbcc traceon(3604)
2> go
DBCC execution completed. If DBCC printed error messages, contact a user with
System Administrator (SA) role.
1> dbcc reindex(js_keys)
2> go
Checking table 'js_keys' (object ID 1792006384): Logical page size is 4096
bytes.
Checking partition 'js_keys_1792006384' (partition ID 1792006384) of table
'js_keys'. The logical page size of this table is 4096 bytes.
The sortorder and character set ID's for index 2 on this table were 50:1 in
sysindexes. They have been corrected to 101:190.
The indexes for 'js_keys' are already correct. They will not be rebuilt.
DBCC execution completed. If DBCC printed error messages, contact a user with
System Administrator (SA) role.
用checktable命令检查一下表js_keys
1> dbcc checktable(js_keys)
2> go
Checking table 'js_keys' (object ID 1792006384): Logical page size is 4096
bytes.
Checking partition 'js_keys_1792006384' (partition ID 1792006384) of table
'js_keys'. The logical page size of this table is 4096 bytes.
The total number of data pages in partition 'js_keys_1792006384' (partition ID
1792006384) is 1.
Partition 'js_keys_1792006384' (partition ID 1792006384) has 5 data rows.
The total number of empty pages (with all deleted rows) in partition
'js_keys_1792006384' (partition ID 1792006384) is 0.
The total number of pages in partition 'js_keys_1792006384' (partition ID
1792006384) which could be garbage collected to free up some space is 0.
The total number of deleted rows in partition 'js_keys_1792006384' (partition ID
1792006384) is 0.
The total number of pages in partition 'js_keys_1792006384' (partition ID
1792006384) with more than 50 percent garbage is 0.
The total number of pages in partition 'js_keys_1792006384' (partition ID
1792006384) with more than 50 percent insert free space is 1.
The total number of data pages in this table is 1.
The total number of pages with more than 50 percent insert free space is 1.
Table has 5 data rows.
DBCC execution completed. If DBCC printed error messages, contact a user with
System Administrator (SA) role.
1>
至此,表js_keys索引已修复完成,一致性检查没有问题了。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21416913/viewspace-743318/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21416913/viewspace-743318/