Pete Freitag Pete Freitag

Cannot shrink log file because all logical log files are in use

Published on August 31, 2007
By Pete Freitag

If you are getting the following error message in Microsoft SQL Server when you try to run DBCC SHRINKFILE (DBNAME_Log):

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

Make sure that there are no running transactions, by running the command on the database in question:

DBCC OPENTRAN

It is possible to shrink the transaction log file while the SQL Server database is online, however if transactions are taking place while the operation is running you may experience this error.

Try running it in off hours the DBCC SHRINKFILE command in off hours, or shut down access to the database from other apps.


Cannot shrink log file because all logical log files are in use was first published on August 31, 2007.

Discuss / Follow me on Twitter ↯

Post a Comment