Solved

.MDF File Sizes

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now