Skip to content

Instantly share code, notes, and snippets.

@michaeljbailey
Created August 29, 2014 18:52
Show Gist options
  • Save michaeljbailey/f7a3d971a35c652e7350 to your computer and use it in GitHub Desktop.
Save michaeljbailey/f7a3d971a35c652e7350 to your computer and use it in GitHub Desktop.
Run this query on a server to figure out why your database log files aren't shrinking. Typically, you'll find databases that have been switch to 'Simple recovery model' but haven't had a full backup taken yet.
SELECT
[state_desc] [State],
[recovery_model_desc] [Recovery Model],
[log_reuse_wait_desc] [Log Reuse Wait Reason],
[name] [Database],
[is_auto_shrink_on] [Auto Shrink Enabled]
FROM [master].[sys].[databases]
ORDER BY [State], [Recovery Model], [Log Reuse Wait Reason], [Database]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment