New answers tagged


In command line: dbunload -c "uid = username"; pwd = "password"; dbf = "DB_old" -an "DB_new" DB_old.db is the name of the original database. DB_new.db is the name of the database shrunken. "DB_old" and "DB_new" the location of the files is relative to the path of the server that is running. If more than one file up the dbspace: DB1_old.db, DB2_old.db, ...


I've tried to use the GUI to shrink the database and the files but it doesn't actually change in size. You said that you truncated large table, in such case you might not be able to shrink "immediately". From Dropping and Rebuilding Large Objects When you drop or rebuild large indexes, or drop or truncate large tables, the Database Engine defers ...


Also bear in mind that shrinking generates LOTS of transaction log itself, so you will need very carefully to manage the size of your transaction log and its backups, while the shrink is running.


Use dbcc shrinkfile('mdfname'). Don't specify notruncate or truncateonly. I've never had to use those options before so I looked them up and they won't do what you want. Notruncate doesn't release the free space from the end of the file back to the OS. Truncately only releases free space from the end of the file but doesn't move pages around to make that ...

Top 50 recent answers are included