The disk alert fires, and it's the .ldf file: 200 GB of transaction log for a 20 GB database. The top search result says to shrink it, so you do, and a week later it's back to the same size.
A growing log is a symptom. Shrinking treats the symptom, and the cause is almost always visible in a single column.
Truncation vs. shrinking
The log is split internally into virtual log files (VLFs). SQL Server writes to them in a circle:
- Truncation (logical) marks inactive VLFs as reusable. The file stays the same size, but its space can be written again.
- Shrinking (physical) hands free space at the end of the file back to the operating system.
The log grows only when SQL Server needs to write and no VLF can be reused. So the real question is: what is stopping truncation?
Ask SQL Server directly
SELECT name, recovery_model_desc, log_reuse_wait_desc
FROM sys.databases
WHERE name = N'YourDb';
log_reuse_wait_desc tells you what's holding the log. The common values:
| Value | Meaning | Fix |
|---|---|---|
LOG_BACKUP | FULL recovery with no recent log backup | Schedule log backups |
ACTIVE_TRANSACTION | A long or forgotten open transaction | Find it and commit or kill it |
REPLICATION / AVAILABILITY_REPLICA | A log reader or secondary is behind | Fix the lagging consumer |
ACTIVE_BACKUP_OR_RESTORE | A full backup is running | Wait for it to finish |
NOTHING | Nothing is blocking truncation now | The growth came from a past burst |
