?
Solved

.MDF File Sizes

Posted on 2004-04-15
3
Medium Priority
?
2,785 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

770 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