Shrink Database Issue - Not enough free space/log in use.

  • With SQL Server 2005 SP3 (running on Windows Server 2003), I tried to shrink the database with the following command:

    DBCC SHRINKDATABASE (bb_bb60, 10)

    DBCC SHRINKDATABASE: File ID 1 of database ID 7 was skipped because the file does not have enough free space to reclaim.

    Cannot shrink log file 2 (bb_bb60_log) because all logical log files are in use.

    (1 row(s) affected)

    DBCC execution completed. If DBCC printed error messages, contact your system administrator.

    Does the above message indicate 1) There is not enough free space in the database to reclaim or 2) There is not enough free space in the database to perfrom the 'shrink' or 'reclaim' operation?

    The message also complains about the log file being in use, I thought you could execute the Shrinkdatabase Command while the database is in use. Is this true? Why am I getting this particular error?

    Are these messages a bad thing?

    Thanks, Kevin

  • The messages are telling you that

    1) The data file has no free space in it

    2) All the logical sections of the log file are in use (full and needed) and so there's no free space in the log.

    Why do you want to shrink? Databases tend to grow as more data gets put in them. It's in their nature.

    Shrinking causes massive fragmentation and will just result in the data file growing again next time data gets added. When that happens, the entire system will slow down as the file is expanded. Also repeated shrinks and grows will cause fragmentation at the file-system level, which is hard to fix.

    See - http://sqlinthewild.co.za/index.php/2007/09/08/shrinking-databases/

    Please read through this - Managing Transaction Logs[/url]

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 2 posts - 1 through 1 (of 1 total)

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