?
Solved

SQL Datasize on Table Large with 0 records in table

Posted on 2011-03-11
6
Medium Priority
?
378 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 2000 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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 Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

752 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