|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 11:49 PM
Points: 173,
Visits: 271
|
|
| Did you try DBCC CleanTable out of curiousity?
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Today @ 6:30 PM
Points: 18,733,
Visits: 12,330
|
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 11:49 PM
Points: 173,
Visits: 271
|
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, April 18, 2013 12:29 PM
Points: 30,
Visits: 48
|
|
Yes, I did DBCC CleanTable. Also, in my earlier results for DBCC SHOWCONTIG the ForwardedRecords=0 as any other field except ScanDensity=100.
I'll try to contact MS and let you know.
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Tuesday, February 12, 2013 1:09 PM
Points: 335,
Visits: 391
|
|
| If the table has < 2000 rows, then you probably wont notice much performance impact anyway while you drop/recreate indexes; that should take care of it.
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, April 18, 2013 12:29 PM
Points: 30,
Visits: 48
|
|
After working with Microsoft the workaround was found:
There is a known issue where on a database having a LOB data in it, the SHRINK operation will only shrinks one empty LOB extent at a time. This is by design. And hence we may have to shrink multiple times to release the space to operating system. This behavior is because we do not deallocate the LOB pages; we save them for the next time we may need to insert LOB data. In certain cases, these allocated but empty LOB pages may accumulate. Again, this is by design.
Also When the LOB value to be inserted is larger than one page, we break it up into page-size fragments. And when we insert a page-size fragment, we don't search the existing LOB pages for free space; we instead just allocate a new page. This is an optimization: in the typical case, the free space fragments on the existing pages are all smaller than a page. Since we need a whole page of free space, we might as well skip the search and just allocate a new page.
NOTE: This behavior is by design and have been reported as a known issue.
Considering the above know behavior of SQL , which is by design the work around to release the empty LOB pages is as follows: Use DBCC CLEANTABLE('databasename', 'tablename') to deallocate all the empty extents.
NOTE: The recommended option to delete all rows of a table is to use TRUNCATE option. Truncate has advantage over the Delete operation as I had mentioned in the previous email.
On your production database backup which I have restored at my end, when I ran the DBCC CLEANTABLE command. The sp_spaceused output after following the workaround was as follows: Please run DBCC UPDATEUSAGE query on the table before you run SP_SPACEUSED query. Please refer link for more details: http://msdn.microsoft.com/en-us/library/ms188414(v=SQL.90).aspx
ADDITIONAL INFORMATION • Pages and Extents http://msdn.microsoft.com/en-us/library/ms190969(v=SQL.90).aspx • Managing Extent Allocations and Free Space http://msdn.microsoft.com/en-us/library/ms175195(v=SQL.90).aspx • Managing Space Used by Objects http://msdn.microsoft.com/en-us/library/ms187501(v=SQL.90).aspx
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Friday, November 12, 2010 9:30 AM
Points: 37,
Visits: 82
|
|
Did you try
Truncate table mytable
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, April 18, 2013 12:29 PM
Points: 30,
Visits: 48
|
|
Yujie Fu (10/22/2010) Did you try
Truncate table mytable
Yes, it released a table space but in production we did DELELE and stuck with the issue.
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Monday, November 19, 2012 9:10 AM
Points: 43,
Visits: 303
|
|
| Miksh, I am trying to understand this better, why was dropping and recreating the table not a desirable solution that you left as a "last resort"? I ask because we drop and recreate tables all the time, it causes no problem.
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: 2 days ago @ 4:14 AM
Points: 151,
Visits: 295
|
|
Hi,
Did you run "sp_spaceused @updateusage= 'true'"? Hope it fixes.
Alternately, pl try below;
Create a filegroup and aleter table to move to the new file group. Then again move the table to the original filegroup and remove the temporary file group you created. This long process is because you do not intend to drop/create an empty table.
I have noticed such problem in SQL 2000 where ntext data type existed and it did not releases the space from table. But the scene was different there as the space were shown in "unused space" which is not the case here. I had to follow the second approach which worked for me.
|
|
|
|