Query the tables and index which will caus rebuild index fail

时间:2021-09-07 18:03:04

On MSSQL server database, while rebuild index failed, we can use the follow sql statement to see if there are some tables' index setting block the operation.

if there are some index of users' table in the query result, we can check if the option setting "Allow page locks" of the index is set with "True". if not, we should set it to "True".

SELECTOBJECT_NAME(i.object_id)as TableName ,

name  as IndexName ,

allow_page_locks

FROMsys.indexesas i

WHEREALLOW_PAGE_LOCKS= 0

The default query result:

Query the tables and index which will caus rebuild index fail