Home Forums SQL Server 7,2000 Backups Cannot shrink log file 2 (LOG FILE) because all logical log files are in use. RE: Cannot shrink log file 2 (LOG FILE) because all logical log files are in use.

  • -- I do the following in a Maintenance Plan (SQL2005)

    Inserted a T-SQL task after the successful backup and DBCC integrity check jobs.

    This goes thru the "simple" recovery_model databases I have just backed up and does:

    USE DBLogicalName

    DBCC SHRINKFILE (DBLogicalName_Log, TRUNCATEONLY)

    If the database is not in SIMPLE recovery mode (or has some other problem), you will get the error below (interactively):

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

    This is not captured by the maintenance plan.

    In my case, some of the log files were not truncated but there was no error in the logs/history.

    Trying the same commands interactively in SSMS, I could see the above message and take corrective action.

    If necessary and allowable, change the recovery_model to simple. In my case, I was surprised to find some of the databases were set to FULL recovery, although I had not meant that. It must be because the original instance installation set the "model" database to "FULL" therefore newly created databases (even restored from another server where they were in "SIMPLE" mode) became "FULL".

    HTH some other budding DBA . . .