[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

.MDF File Sizes

Posted on 2004-04-15
3
Medium Priority
?
2,788 Views
Last Modified: 2012-05-04
I have a database that was roughly 230 GB large.  I deleted all tables in the database and the .mdf file was still 230 GB large.  Does the delete from table, truncate from table, and/or the drop table commands not physically remove the data from the .mdf file?  I ended up detaching the database and deleting it to regain the space but I am concerned over the implications that this could have on other databases that I have.  Any advise would be appreciated.
0
Comment
Question by:xKilent
3 Comments
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 250 total points
ID: 10834112
what you need to do is to SHRINK the database.  This is the SQL Server equivalent of COMPACTing an Access MDB.  What is happeing is this.  As data is added to your Tables, they grow, and the MDF grows.  When you delete data, or Tables, the MDF does NOT automatically reduce in size (aftrer all, you may wnat to add more data, and the space is already trhere, to accomdate that).

In Enterprise Manager, open the Databases Tab, then right click on the Database entry, then choose Shrink Database...

AW
0
 
LVL 3

Expert Comment

by:debi_mela
ID: 10835228
"I ended up detaching the database and deleting it to regain the space but I am concerned over the implications that this could have on other databases that I have.  Any advise would be appreciated. "

Does this mean that you don't need this database anymore.  If so, you can detach and delete this .MDF and corresponding .LDF file, it will not affect other databases.
  If not, as suggested earlier you need to  shrink the database and truncate empty space.

-Deb.
0
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 10838465
was it just your MDF that was big , what size was your log file?

you need to consider scheduling regular shrink / optimisation jobs on databases of this size...

what version and edition of SQL server..?



PS there is a separate topic area for SQL SERVER related questions
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In this article, we’ll look at how to deploy ProxySQL.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question