August 24, 2004 at 6:22 pm
Randy
Try these simple steps:
-- Ask SQL Server to update and display file usage
EXEC sp_spaceused @updateusage= 'TRUE'
-- Get SQL Server to DEFRAG the data inside the files,
-- and then remove excess free space
DBCC SHRINKFILE (Yourdatabasename)
You should then see less free space in your files.
The DBCC SHRINKFILE task may take a long time, depending on how big your database is and how badly fragmented the data pages inside the database files are. Probably best to read up about the commands before running them. It doesn't defrag the file in your filesystem! Just the data inside the file.
There are some limitations of course! If when you CREATE/ALTER the database, you set a starting size of the database, you cannot shrink the files to be smaller than that starting size. So if you create a database with 2GB size, and only put 500MB of data in it, you can't shrink it back down to 500MB.
Also, your data files may grow if part of your database maintenance plan is to reindex your databases.
Julian Kuiters
juliankuiters.id.au
August 25, 2004 at 8:21 am
Allen and Julian,
Great stuff. I am going to drop the clustered index off my biggest two tables and re-create as non-clustered. I will schedule the Optimization job to run this weekend to Reindex and Shrink the database. If the problem isn't fixed with the index modification, I will manually shrink it.
If that doesn't work...we're getting quotes for SQL2K.
Thanks alot,
Randy
August 25, 2004 at 8:49 am
Julian
I believe the restriction of not being able to shrink below original allocation size went away with 2k. At least if you explicitly state the shrink to size.
I will try and do a test over the weekend.
KlK
August 25, 2004 at 6:00 pm
I wish... I've had to deal with a number of databases that had an initial / minimum size specified too high.
Julian Kuiters
juliankuiters.id.au
Viewing 4 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply