Solved

.MDF File Sizes

Posted on 2004-04-15
3
2,781 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 125 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
add and run outdated exchange database to an Exchange server 1 54
ServiceCenter IR Query Expressions 1 49
.lee file containing data 5 49
corrupt Databases 9 79
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

685 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