DBCC SHRINKDATABASE
DBCC SHRINKDATABASE: administrative check or maintenance
What changes
- Input
- database, table, index, cache or server state named in the command
- Output or change
- messages or result sets; maintenance forms change storage, caches or metadata
Syntax at a glance
DBCC SHRINKDATABASE ( database_name | database_id | 0 [ , target_percent ] [ , { NOTRUNCATE | TRUNCATEONLY } ] ) [ WITH { [ WAIT_AT_LOW_PRIORITY [ ( <wait_at_low_priority_option_list> ) ] ] [ , NO_INFOMSGS ] } ]
Work example
A one-time data removal leaves space that the database will not reuse.
Confirm the space will stay unused, review fragmentation and log impact, and choose a recovery window.
Check your work The target size leaves room for normal growth and the workload does not trigger repeated regrowth.
Open Microsoft Learn for full syntax, permissions, and details for your version.