Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Too big amount of unused space after shrink of image field contents Expand / Collapse
Author
Message
Posted Tuesday, May 11, 2004 6:23 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, August 9, 2010 4:41 PM
Points: 11, Visits: 14

We store a big amount of images in our SQL Server DB in column of type 'image' . Now we try to make space used by DB smaller by shrinking the images stored in the image fields.

After completion of the shrinking process I run 'sp_spaceused' and found that the space occupied by table is close to be the same and most of the new free space is specified as unused

We will never add any new information to this table. Will SQL Server use the unused space of this table for the new data added to the other tables or we have to cause SQL Server to make reallocation? How we can reorganize the unused space?

Thank you very much for any help,

a_k_

Post #115489
Posted Thursday, May 13, 2004 11:11 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, November 29, 2004 3:25 PM
Points: 9, Visits: 1

The best thing I found for this problem is to set up a mainatain plan that runs every night. make sure you optimise the database. tick the 'Remove unused space from database files' this really helps. also in propertise tick the 'Auto shrink'

also I found that detaching and reattaching the database does help (don't recommend you do this too often). but if you dettach the database what SQL server does is automatically shrinks the database (reclaims unused space). when you attach it again it will attach it with no unsed space available, thus making it the minimum size again. 

 

 

Post #115919
Posted Friday, May 14, 2004 4:07 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, August 9, 2010 4:41 PM
Points: 11, Visits: 14

Thank you for your help. I tried both methods, no one removes unused space created by fragmentation of the image fields. After each attempt I run 'sp_spaceused' with 'updateusage' option for this table and all the values are the same (the same size of unused data for this table) . It seems like all those methods do not move data within space where image data stored.

Is there any method to reorganize image data space?

The only method that I found is to copy all the contents of the table to a new table. I hope it suppose to be some easier way. The table size is more then 100GB.

Thanks,

a_k_

Post #116094
Posted Thursday, June 10, 2004 1:33 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, February 15, 2012 12:01 PM
Points: 2, Visits: 21
If the table is clustered (has a non-clustered index, then you can try a DBCC DBREINDEX (tablename,'',100). The '' specifies to reindex all indexes on the table, and the 100 specifies to completely fill the data pages when done.

If not, then create a clustered index on any column, specify a fill factor of 100. After creation you can drop the index.

Unfortunately, this process could take a while on a 100GB table.
Post #120473
Posted Wednesday, October 27, 2010 1:29 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, July 25, 2014 6:37 AM
Points: 1,385, Visits: 1,242
I know this topic is long-dead, but in case someone finds it while searching for LOB unused space issues, the following topics deal with the same issue and offer a work-around for freeing the unused space:

http://www.sqlservercentral.com/Forums/FindPost740006.aspx
http://www.sqlservercentral.com/Forums/FindPost1011086.aspx


http://poorsql.com for T-SQL formatting: free as in speech, free as in beer, free to run in SSMS or on your version control server - free however you want it.
Post #1011308
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse