July 30, 2008 at 7:34 am
I have 300 GB user database I can see around 150 free space on data file.
When I tried to shrink database my MDF file still shows me 300 GB how to shrink this.
I ran DBCC command and shrink Database but no impact.
July 30, 2008 at 7:44 am
Hi,
Try to shrink file instead of database, this would make the file shrink.
If this does not help, then you must see what the initial size of database(datafile) is set to.
July 30, 2008 at 8:05 am
I did that when I do shrink file I am getting this error below:
A server error occured on the current command. The results, if any, should be discarded File ID 1 of database ID 7 canot be shrunk as it is either being shrunk by another process or is empty
July 30, 2008 at 9:45 am
Hi,
Ok This means that your original job to shrink is still running in the background.
Do a sp_who2 and a sp_lock to see which process is holding that database. then once you have that then you can do a dbcc inputbuffer (spid) to check the command that is running.
You are going to have to wait for it to stop, don't restart sql server as you will get a corruption on the databases.
Hope this helps
July 30, 2008 at 12:28 pm
Nope nothing is been running, I checked earlier and I didnow as well.
July 30, 2008 at 1:14 pm
Hi
What is the error code it gives you with the last error??
July 30, 2008 at 2:24 pm
Are you trying to shrink this down to 150MB? You want to keep free space in the file in general.
The shrinking can be slow or fast, depending on the load your DB experiences and the locks that might be held on files. It can take some time.
Can you restart the instance and then try shrinking if you really need to?
July 30, 2008 at 3:26 pm
Nita,
Please make sure AUTOSHRINK option is turned OFF for the database in question.
Also, try shrinking database file in chunks rather than specifying a big size in one shot. Use dbcc shrinkfile(fileid,DesiredSize)
Size--Specify the desired size which is 150,200 MB or 1 GB(it is based on the server I/O subsystem) less than the current size.
For 300 GB database specify dbcc shrinkfile(1,299000) first if it works fine and completes in less than 10 minutes than go ahead with reducing the shrink size during later executions.
Perform this activity when database is used at minimum.
Manu
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply