Having trouble shrinking a SQL 7 Database

  • I'm currently in a situation where I'm trying to shrink a DB and it's taking a real long time.  This is sort of an extreme example - the DB size is 217GB, and only about 35GB are actually in use.  This is the thing - I tell it to shrink the DB, and after a while it does that lovely Windows thing where everything inside the window "blanks out."  The drive light isn't flickering much.  Task manager says that the application is "not responding," and when I do an sp_who 'active', the process is apparently "sleeping."

    So, I'm thinking, "Ok, this locked up."  I check the CPU utilization in task manager, and it's averaging around 20-25%.  However, after I cancel the process, CPU utilization goes down to about 5%.  So it's obviously doing something.

    What should I do?  Just let it run?  Is it bad to use the DB while it's shrinking?

  • I shrink my files in small increments (1gb or 2GB) till I get a handle on how long it appears to take. I hate teat 'not responding' message too!

  • When I need to shrink a large file like that I set up a maintenance plan to do it and then let it run over a weekend or another time period when no one else is going to need the server.

  • I agree with Craig - set up the shrink as a task - try using shrinkfile - I don't like using the maintenance task shrink method it never seems to work properly.

    --Cut from T-SQL help

    USE UserDBGODBCC SHRINKFILE (DataFile1, 7)GO
    Where Datafile1 is your file to shrink and the number is the target 
    file size in MB.
    Sim


    Cheers,

    Sim Lever

  • Sorry - carriage returns lost in transit!!!

    USE UserDB
    GO
    DBCC SHRINKFILE (DataFile1, 7)
    GO

     


    Cheers,

    Sim Lever

  • Thanks, guys.  I think I'm gonna go ahead and set it up to run as a task over the weekend. 

Viewing 6 posts - 1 through 5 (of 5 total)

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