DBCC SHRINKFILE not working for datafile

  • I am trying to shrink a datafile with dbcc option to gain some disk space, but its not working, running indefinitely. Any guess why its not performing.

    Thanks

    Vivek

  • Why are you trying to shrink data file ..it can leads to fragmentation i.e poor index selection.

    instead you can go for log shrinking

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • Anyways ,,if you still want to shrink data file ..you can use the TRUNCATE_ONLY option in DBCC shrinkfile

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • :-)No option working. Have tried everything.

  • Try with DBCC shrinkdatabase ...and if it still doesnt work ..take a full backup and then try shrinkdatabase

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • Try increasing the allocated size of your 1st datafile.

  • As C_C_ said increase the size of your datafile lets say by 10 MB. Instead of releasing the entire space at once try and shrink the file in smaller chunks for eg. release 100 MB in one go and so on till you get yourself the desired amount of free space. This way your shrink operation will be faster

  • Shrink database didn't work. I have tried it before. Also, increasing the size and then shrinking is not sufficing the requirement too.

    Vivek

  • Are you shrinking in smaller chunks?

  • Yes and in multiple of 8, but no luck.

  • Are you getting error or is it just not completing. Try and see if something is blocking your process. If not then there could be many user connections against the database. Try shrinking the files when connections are at a minimum.

  • - what kind of size are we talking about (current , target) ?

    - how long did you wait for it to complete ?

    - check (b)locking when you run dbcc shrinkfile ...

    - are other users connected to that database ?

    - how often do you run dbcc checkdb ?

    - did you start with a full backup ?

    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

  • Its just not completing. No blockings, no user connection even.

  • How much time are you waiting before cancelling it. Sometimes there is too much page arrangements going on inside which can take a lot of time. If there is no blocking then let it run for a while.

  • How much free space is in the database files ?

    What command did you run ?

    How long did it run ? Did you cancel it ? I had to shrink a large db file (300 G file in 1.2 Tb db) once and it took 24+ hours

    Do you really need to shrink it ?

Viewing 15 posts - 1 through 15 (of 60 total)

You must be logged in to reply to this topic. Login to reply