Solved

SQL Datasize on Table Large with 0 records in table

Posted on 2011-03-11
6
376 Views
Last Modified: 2012-06-27
I deleted all the rows in a table and the data size is still 7.5 gb.  Who do I release all that unused space.
SpacePic.jpg
0
Comment
Question by:rdray
[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
6 Comments
 
LVL 28

Accepted Solution

by:
Ryan McCauley earned 500 total points
ID: 35112258
This happens when you DELETE records from a table - they're not actually deleted, just marked as deleted, and then overwritten later.

If you want to free up the space, issue this instead:

TRUNCATE TABLE dbo.SYSDATABASELOG

Open in new window


This will reset the high water mark on the table and free up the reserved space. You'll still have the space allocated in your data file, though - you'll need a DBCC SHRINKDB to free that up.
0
 
LVL 40

Expert Comment

by:lcohan
ID: 35112259
You could try DBCC UPDATEUSAGE on that table like below and check after that:

DBCC UPDATEUSAGE ('db_name','table_name')  -- WITH NO_INFOMSGS
0
 
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 35112263

Try shrinking the database

Right click on the database, select Tasks->Shrink->Database

0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 40

Expert Comment

by:lcohan
ID: 35112320
Caution shrinking live on line databases even on SQL 2008.
0
 

Author Comment

by:rdray
ID: 35112633
All these are great.. I have done all of them with no change.
0
 
LVL 40

Expert Comment

by:lcohan
ID: 35112714
do you have a clustered index on it? if not try create one then drop, if yest try drop then re-create.
0

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.

726 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