Rebuild Index Task

The Rebuild Index task rebuilds indexes in SQL Server database tables and views. For more information about managing indexes, see Reorganize and Rebuild Indexes.

By using the Rebuild Index task, a package can rebuild indexes in a single database or multiple databases. If the task rebuilds only the indexes in a single database, you can choose the views and tables whose indexes the task rebuilds.

This task encapsulates an ALTER INDEX REBUILD statement with the following index rebuild options:

  • Specify a FILLFACTOR percentage or use the original FILLFACTOR amount.

  • Set PAD_INDEX = ON to allocate the free space specified by FILLFACTOR to the intermediate-level pages of the index.

  • Set SORT_IN_TEMPDB = ON to store the intermediate sort result used to rebuild the index in tempdb. When the intermediate sort result is set to OFF, the result is stored in the same database as the index.

  • Set IGNORE_DUP_KEY = ON to allow a multirow insert operation that includes records that violate unique constraints to insert the records that do not violate the unique constraints.

  • Set ONLINE = ON to not hold table locks so that queries or updates to the underlying table can proceed during re-indexing.

Note Note

Online index operations are not available in every edition of Microsoft SQL Server. For a list of features that are supported by the editions of SQL Server, see Features Supported by the Editions of SQL Server 2012.

For more information about the ALTER INDEX statement and index rebuild options, see ALTER INDEX (Transact-SQL).

Important note Important

The time the task takes to create the Transact-SQL statement that the task runs is proportionate to the number of indexes the task rebuilds. If the task is configured to rebuild indexes in all the tables and views in a database with a large number of indexes, or to rebuild indexes in multiple databases, the task can take a considerable amount of time to generate the Transact-SQL statement.

You can set properties through SSIS Designer. This task is in the Maintenance Plan Tasks section of the Toolbox in SSIS Designer.

For more information about the properties that you can set in SSIS Designer, click the following topic:

Rebuild Index Task (Maintenance Plan)

For more about how to set these properties in SSIS Designer, see Set the Properties of a Task or Container.

Integration Services icon (small)  Stay Up to Date with Integration Services

For the latest downloads, articles, samples, and videos from Microsoft, as well as selected solutions from the community, visit the Integration Services page on MSDN:

For automatic notification of these updates, subscribe to the RSS feeds available on the page.

Community Additions