Determining Why a Database Log File Will Not Shrink

8:31 PM

Many times when trying to shrink the log file of a database you are unable to do so, even after backing up the log.  The following query is useful in letting you know if there is an active transaction which is keeping you from being able to shrink the database transaction log file.

SELECT name,  database_id , state_desc ,  recovery_model_desc ,  log_reuse_wait_desc
FROM sys.databases
ORDER BY name
The last column in the query results, log_reuse_wait_desc, will tell you what is keeping you from being able to shrink the log file. If there is not anything stopping the shrinking of the file the log_reuse_wait_desc will be NOTHING.

You Might Also Like

0 comments

Contact Form

Name

Email *

Message *

Translate

Wikipedia

Search results