Solved

.MDF File Sizes

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

This article describes some very basic things about SQL Server filegroups.
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
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…

772 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