Shrink Database Task
The Shrink Database task reduces the size of SQL Server database data and log files.
By using the Shrink Database task, a package can shrink files for a single database or multiple databases.
Shrinking data files recovers space by moving pages of data from the end of the file to unoccupied space closer to the front of the file. When enough free space is created at the end of the file, data pages at end of the file can deallocated and returned to the file system.
Data that is moved to shrink a file can be scattered to any available location in the file. This causes index fragmentation and can slow the performance of queries that search a range of the index. To eliminate the fragmentation, consider rebuilding the indexes on the file after shrinking.
The Shrink Database task encapsulates a DBCC SHRINKDATABASE command, including the following arguments and options:
NOTRUNCATE or TRUNCATEONLY.
If the Shrink Database task shrinks multiple databases, the task runs multiple SHRINKDATABASE commands, one for each database. All instances of the SHRINKDATABASE command use the same argument values, except for the database_name argument. For more information, see DBCC SHRINKDATABASE (Transact-SQL).
Configuration of the Shrink Database Task
You can set properties through the 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 the SSIS Designer, click the following topic: