Shrinking the database size (SQL 7)
We have a SQL 7 database that grew to about 50GB. Needless to say we've done
some work to minimize the size of it, but we've come to a problem trying
to release all the unused space to the OS. (Amount of data is about 13 GB).
We've tried to run the "Shrink Database" option in Ent. Mgr., and after working
for a long time, it simply stops responding, so we have to kill it with Task
Manager. Then, we created a SQL Job and scheduled it to run in the middle
of the night. That time it completed (about 14 hours later), and it shrunk
the file by 5 GB.
The statements we're using are:
1. DBCC SHRINKDATABASE (<db_name>, TRUNCATEONLY)
to let SQL determine how much it can take off
2. DBCC SHRINKDATABASE (<db_name>, 10)
to force it to leave 10% of free space (actually we've tried different options
5%, 10%, 50% and no setting seems to matter.
We'd appreciate your input for we are wasting valuable space on our server.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center