Log won’t shrink in SIMPLE Recovery mode

I recently had a situation where a database that was set to SIMPLE recovery mode had an ever-growing log file. I had tried a number of things to get it to shrink (i.e. running CHECKPOINT: and the DBCC SHRINKFILE(…) to no avail. I know that the log file should be truncated every few minutes due to the CHECKPOINTs SQL Server regularly issues, unless there are open transactions. I then tried running:

This is what I got:

REPL_NONDIST_OLD_LSN

I then tried running the statement below:

This query showed that the database was marked for “Replication”. Replication existed on this server, but not for this database. We have not used replication for a long time now (we use log-shipping for our needs). I ran the following command to drop the database for replication:

I then re-ran the command to verify that it is no longer marked for replication:

Now that it is no longer marked for replication, we can shrink the log file. If you need to set the recovery mode to SIMPLE, use this:

…now shrink the log file:

After executing this command, confirm that the log was shrunk from whatever it was to 10MB. You can use the command below:

Don’t forget to ALTER the database back to FULL recovery model if it needs it.

NOTE

I have read MANY blogs that stated the following command will fix the issue:

…however, it seems that this will temporarily fix the issue but it will continue as it simply marks the log entries as replicated. It does not resolve the real issue of removing the database from replication.

Here is a good forum posting on this issue: log_reuse_wait_desc = replication, transaction log won’t stop growing

Views – 2388