Solved

SQL Datasize on Table Large with 0 records in table

Posted on 2011-03-11
6
372 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
6 Comments
 
LVL 28

Accepted Solution

by:
Ryan McCauley earned 500 total points
Comment Utility
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 39

Expert Comment

by:lcohan
Comment Utility
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:ewangoya
Comment Utility

Try shrinking the database

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

0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
LVL 39

Expert Comment

by:lcohan
Comment Utility
Caution shrinking live on line databases even on SQL 2008.
0
 

Author Comment

by:rdray
Comment Utility
All these are great.. I have done all of them with no change.
0
 
LVL 39

Expert Comment

by:lcohan
Comment Utility
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 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

6 Experts available now in Live!

Get 1:1 Help Now