sybase rebuild index

Xinspirit發表於2012-09-13

用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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章