Shrink the size of the database data and log files.
Syntax DBCC SHRINKDATABASE ('database' option [,option] ) [WITH NO_INFOMSGS] DBCC SHRINKDATABASE ('database_id' option [,option] ) [WITH NO_INFOMSGS] DBCC SHRINKDATABASE (0 option [,option]) [WITH NO_INFOMSGS] Options: target_percent NOTRUNCATE TRUNCATEONLY Key: 0 - Shrink the current database target_percent - Percentage of free space to remain in the database file NOTRUNCATE - Free space at the end of the data file is not returned to the OS (pages are still moved) TRUNCATEONLY - Release free space at the end of the data file to the OS (do not move pages) NO_INFOMSGS - Suppress all information messages (severity 0-10)
Only one of the truncate options can be specified - they do not apply to log files.
Example
DBCC SHRINKDATABASE (MyDatabase);
“Men shrink less from offending one who inspires love than one who inspires fear” ~ Niccolo Machiavelli
Related:
ALTER DATABASE
DBCC SHRINKFILE
FILE_ID
sys.database_files
Equivalent Oracle command:
ALTER DATABASE... DATAFILE...