DBCC SHRINKDATABASE works for me, but this is the full syntax:
DBCC SHRINKDATABASE ( database_name, [target_percent], [truncate] )
where target_percent is the desired percentage of free space remaining in the database file after shrinking the database.
And the truncate parameter could be:
NOTRUNCATE
Causes freed file space to be stored in database files. If not specified, freed file space will be released to the operating system.
TRUNCATEONLY
Invokes any unused space in the data files that will be released to the operating system, and compresses the file to the last allocated area, reducing the file size without moving any data. No attempt is made to move lines to unallocated pages. target_percent is ignored when using TRUNCATEONLY.
... and yes no_one is right, reducing datbase is not a good practice, for example, for example:
compressing data files are great ways to introduce meaningful logical fragmentation, as it moves pages from the end of the selected range of the database file to somewhere in the front of the file ...
Shrinking a database can make a big difference to the database server .... think a lot about it before you do it!
There are many blogs and articles on the Internet about this.
Cicik Jan 13 '09 at 14:38 2009-01-13 14:38
source share