April 23, 2006 at 11:08 pm
Hi Guys
I have a 62 Gig SQL 2000 SP4 Db. After deleting +- 40 gig of data Sp_SpaceUsed,'true' reports:
Database_size Unallocated space
61269.69 MB 17.07 MB
Reserved Data Index_size Unused
62601080 KB 21701344 KB 698040 KB 40201696 KB
Is there a way to reclaim the 40 Gig Unused space as Unallocated space (Db Freespace)?
If you look at one of the tables from which a lot of data was deleted, sp_spaceused reports:
sp_spaceused bodytext,'true'
Name Rows Reserved Data Index_Size Unused
BodyText 698972 19659096 KB 3326784 KB 88 KB 16332224 KB
The Table has 19Gig Reserved space, 3.3Gig Data & 16 Gig Unused.
Is there a way to reduce the Reserved space and reclaim the Unused space as db freespace?
I have tried:
1. Rebuilding all the indexes.
2. DBCC UpdateUsage (0) WITH COUNT_ROWS
3. sp_spaceuse @updateusage = true
4. Tried to update usage on each effected table with sp_spaceused
bodytext,'true'
5. Enterprise Manager / All Tasks/ Shrink Database/Shrink Files with the 'Compress pages and then truncate freespace from the file'
None of the above had any effect.
Any suggestions will be welcome!
April 24, 2006 at 12:35 am
do all tables have a clustering index ?
I guess not. So for this maintenance time, you may want to create one (for each table ! ). If you just pick one arbitrarly, just create it, and drop it again. This way your datapages will be reorganized and pages will be freed if they nolonger contain rows.
If you pick a CLI (clustring index) that might meet query-needs, create it and whatch it's behaviour for a while (sql-perfmon), so you can evaluate if it hurts or not. You may also want to take a look at PAD_INDEX and FILLFACTOR.
Maybe you'll want to use the sqlmaint.exe or create a maintenance plan. Check books online.
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
April 25, 2006 at 7:46 am
Please try this, it has worked for me.
1. Backup your database
2. Set your database to simple
3. Shrink your database
4. Set your database back to full
5. Backup your database
April 25, 2006 at 10:18 am
use QA or job to shrink the datafile, EM doesn't do the job
use
dbcc shrinkfile(fileid)
It's brutal but this will reclaim the max space. Issue a checkpoint command first.
[font="Comic Sans MS"]The GrumpyOldDBA[/font]
www.grumpyolddba.co.uk
http://sqlblogcasts.com/blogs/grumpyolddba/
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply