SQL Server error 9002: transaction log is full. How do I fix it?
Resolved SQL
BH
Brian Hollis
November 4, 2026
4 replies
2,951 views
Reviewed by moderators
3 participants

Our app suddenly stopped saving data. The error is "The transaction log for database 'Sales' is full due to LOG_BACKUP". The database is 20GB and the log file grew to 180GB. Disk is at 98%. What do I do?

Accepted answer
Marked as the solution to this question

The error message already gives the reason. Confirm it with:

SELECT name, recovery_model_desc, log_reuse_wait_desc FROM sys.databases WHERE name = 'Sales';

LOG_BACKUP means the database is in FULL recovery model and nobody has been taking log backups. In FULL recovery the log is only cleared after a log backup, so it grows until the disk fills.

Fix: take a transaction log backup.

BACKUP LOG Sales TO DISK = 'E:\Backups\Sales_log.trn';

You need enough space for that backup file, so put it on another drive. After it succeeds the log space inside the file is reusable and the app should start writing again.

Log backup finished and the app is working again. But the file is still 180GB and the disk is still full.

Backing up the log makes space inside the file reusable but does not make the file smaller. To shrink it, once:

USE Sales; DBCC SHRINKFILE (Sales_log, 8192); (target size in MB, here 8GB)

Select a size that fits your normal peak, not the smallest possible, or it just grows again. Do not shrink on a schedule.

Then fix the real cause. Either schedule log backups every 15 to 30 minutes (agent job or maintenance plan), or if you do not need point-in-time restore, switch the database to SIMPLE recovery. Check also DBCC OPENTRAN in case a very old open transaction was holding the log.

Shrunk to 10GB and set up a log backup job every 20 minutes. We had never configured it after the migration. Thanks guys.