how to compress / shrink an msde 2000 database

I have a windows 2000 server running msde.  It now has a database file that is almost 2 gb, the max it will allow.  I know one of my options is to move it to a sql standard server, but this database is just not worth the work or cost.  I have cleaned out some of the junk data in the database.  I am hoping I can run some sort of maintenance on the database to compress/shrink/defrag it.  It looks like I will be using the osql command, but I can only find documentation on how to use this to backup, move or restore the file, not perform any other maintenance on it.  Any advice would be helpful
LVL 3
lrpageAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
terjohConnect With a Mentor Commented:
As long as you have OSQL installed, run the following at a command prompt to compress the database:

osql -U [user name] -P [password] -S (local)\[Server Instance Name] -d [database name] -Q "DBCC SHRINKDATABASE ([database name])"

Let me know if you have any problems!!
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
if the file size has grown to 2GB, keep it there. if you cleaned out some tables, there will be free space available for new records
0
 
lrpageAuthor Commented:
That was the command I was looking for.  Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.