Perform a database shrink
A database shrink recovers unused storage space of your database. You can manually run a
database shrink or automatically run it with a schedule after log or archive cleanup
tasks. Shrinking the database may be followed by an automatic index rebuild. Both
operations could take a long time, affect database performance, and cannot be stopped
once initiated.
Prerequisites
- Make sure that you have theConfigure Database Maintenancepermission.
- Make sure that you have a membership in the Microsoft SQL Server db_owner database role or sysadmin server role.
To manually run a database shrink
- OnTools, selectDatabase Management.
- OnDatabase Management, selectDatabase Maintenance.
- In theManual database index maintenancesection, selectStart Shrink.
To automatically run a database shrink with a schedule
- OnTools, selectDatabase Management.
- OnDatabase Management, selectDatabase Maintenance.
- In theSchedule Archive/Log Cleanupsection, create or edit log or archive cleanup tasks, and then select theShrink the databasecheckbox. In the percentage list, enter any integer from 30 to 70. A database shrink will be initiated after the log or archive cleanup task if the available free space exceeds the configured threshold.
- SelectOK.IMPORTANT:When a log or archive cleanup task is running, some user or system requests may be paused because Microsoft SQL Server may lock tables to delete data. If a database shrinking task follows, it may take even longer. While the requested operations will resume once the tables are unlocked, the waiting time depends on the amount of data being processed, and unexpected issues may occur. We recommend not using the FactoryTalk AssetCentre system during log or archive cleanup tasks.For more information, see Create a log cleanup schedule and Create an archive cleanup schedule.
Provide Feedback