Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Database size
Message
From
23/09/2002 10:30:11
 
 
General information
Forum:
Microsoft SQL Server
Category:
Database management
Title:
Miscellaneous
Thread ID:
00700882
Message ID:
00703373
Views:
20
I found the problem.
My tables didn't have any clustered index. I only have non-clustered indexes.
So, I wasn't able to defragment the data. SQL Server only permits to defrag indexes.

What I did was create a clustered index on each table (this automatically defrags the table data as it reorders the data itself). The I can drop this index and all the space that was ocupied by data fragmentation (that was the so called «unused space»), turned into free space, available to dbcc shrinkfile to reclaim.

Thank you anyway.



>DBCC SHRINKDATABASE() and DBCC SHRINKFILE() are the correct tools to use. Are you getting somekind of message?
>
>-Mike
>
>>I have several databases that have a lot of «Unused Space».
>>I can't figure out why nor how to free that space.
>>Here is the situation:
>>
>>I have several tables in the database that report the following kind of values from sp_spaceused:
>>
>>Reserved: 300000 KB
>>Data: 38000 KB
>>index_size: 2500 KB
>>Unused: 258000 KB
>>
>>But I can't in any way recover this space. Not using dbcc shrinkdatabase nor using dbcc shrinkfile.
>>
>>The only way I can free the space is to bulk copy the data out of each table and then back in.
>>If in the table where I issued the sp_spaceused before (the example above) i do:
>>
>>select * into newtable from oldtable
>>drop oldtable
>>
>>and recreate the primary keys, indexes, etc. on the new table, when i do a sp_spaceused on this new table i get something like:
>>
>>Reserved: 21000 KB
>>Data: 20000 KB
>>index_size: 500 KB
>>Unused: 80 KB
>>
>>
>>Can anyone help me please ? How do I recover the space without bulk copying every table out and in ?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform