Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Reclaim Space From Varbinary Change

Author  Topic 

mfemenel
Professor Frink

1421 Posts

Posted - 2009-12-04 : 14:31:36
We have a table, 900 k rows that is about 125 GB worth of storage size. It has a varbinary max colum in it. In order to reclaim space some people updated the varbinary columns to null on about half the records because the data in the column was unncessary but the record was still needed. The challenge we're having is reclaiming the space.
Now before you fire off a response, here's what we've tried.
Cleantable
shrink db
drop clustered index/recreate

We don't have enough disk space left to make a copy of the table and then move the data over either so I'm running out of ideas. This is on SQL 2005, SP2. Have at it!

Mike
"oh, that monkey is going to pay"

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-04 : 14:39:15
Perhaps the space has been reclaimed but the reports aren't showing it. Could you run DBCC UPDATEUSAGE just in case?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

mfemenel
Professor Frink

1421 Posts

Posted - 2009-12-04 : 14:40:34
I was hoping you'd chime in ! Will try it out.


Mike
"oh, that monkey is going to pay"
Go to Top of Page

mfemenel
Professor Frink

1421 Posts

Posted - 2009-12-04 : 14:59:22
Didn't help tara


Mike
"oh, that monkey is going to pay"
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-04 : 15:12:57
Perhaps you are encountering the bug mentioned in this thread: http://www.bigresource.com/Tracker/Track-ms_sql-3uYgY0NQ/

I'm not sure if there is a hotfix for it, but I'd suggest upgrading to sp3 and the latest cumulative update package. I know CU5 was out in October, but there may be a higher CU by now.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

mfemenel
Professor Frink

1421 Posts

Posted - 2009-12-04 : 15:20:35
bah. You're supposed to have a magic wand for me tara! we have microsoft stumped too. So far they're recyclng the same ideas we've already tried. Question. Would creating a copy of the table and putting the new table and old table on the same partition using the same scheme function and then switching the partition to the new table do anything? I have a feeling I'd just be trading pointers to a new object id and not eliminate the issue but I don't know enough about the under the covers stuff with partitioning.


Mike
"oh, that monkey is going to pay"
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-04 : 15:22:54
I haven't a clue if that would work or not. Got another server with ample storage to test it out?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

mfemenel
Professor Frink

1421 Posts

Posted - 2009-12-04 : 15:34:59
Ah...funny when Prod is down all of a sudden people can give you access to servers. I just was given on (asked this morning!) Will try it out.


Mike
"oh, that monkey is going to pay"
Go to Top of Page

mfemenel
Professor Frink

1421 Posts

Posted - 2009-12-04 : 16:34:31
Well if anyone ever comes across this thread, the partition idea didn't pan out.


Mike
"oh, that monkey is going to pay"
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-12-04 : 16:42:19
How about setting the text in row option:

sp_tableoption N'MyTable', 'text in row', 'ON'

And then do an UPDATE to reset the varbinary column to null again:

UPDATE MyTable SET binCol=Null WHERE binCol IS NULL
Go to Top of Page
   

- Advertisement -