Tag Archives: rebuild index

DBCC DBREINDEX in Microsoft SQL Server

Rebuilds one or more indexes for a table in the specified database in SQL Server

Rebuilds one or more indexes for a table in the specified database.

Syntax

DBCC DBREINDEX
(    'database.owner.table_name'
[ , index_name
[ , fillfactor ]
]
)


Remarks
DBCC DBREINDEX rebuilds an index for a table or all indexes defined for a table. By allowing an index to be rebuilt dynamically, indexes enforcing either PRIMARY KEY or UNIQUE constraints can be rebuilt without having to drop and re-create those constraints. This means an index can be rebuilt without knowing the table’s structure or constraints, which could occur after a bulk copy of data into the table.

Examples
A. Rebuild an index
This example rebuilds the clustered index with a fill factor of 80 on the authors table in the pubs database.

DBCC DBREINDEX ('pubs.dbo.authors', UPKCL_auidind, 80)

B. Rebuild all indexes
This example rebuilds all indexes on the authors table using a fill factor value
of 70.

DBCC DBREINDEX (authors, '', 70)