Tuesday, June 28, 2011

Reindex The Database With A Large Gap With "DBCC DBREINDEX"


DBCC commands is one of the most commonly used are DBAs worldwide. Today I'm going to present a simple way to index the specific table or all indexes using DBCC.

The command used for this is

DBCC DBREINDEX

General Sytax

DBCC DBREINDEX

(

table_name

[, Index_name [, fillfactor]]

)

The best feature of this command is that we need not abandon such unique or primary key restrictions applied to the index to rebuild the index. This means that the index can be rebuilt without knowing the structure of a table or limitations.

It accepts three parameters. The table name, index name and the fill factor.

This is an example below

The command below will not be indexed and table "IDX_EMPL" "TBL_DIM_EMPL" with a fill factor of 80

DBCC DBREINDEX ("TBL_DIM_EMPL", "IDX_EMPL", 80)

The following command reindex all indexes on the table "TBL_DIM_EMPL"

DBCC DBREINDEX ("TBL_DIM_EMPL", "", 80)

No comments:

Post a Comment