Gouache painting of a rowboat with two oars and a spare pair on the dock, one spare oar vermilion

Remove Extra Log File in SQL Server: Fix Error 5042

To remove extra log file members, SQL Server needs the files to hold no active log. When one does, ALTER DATABASE REMOVE FILE fails with Msg 5042. This post builds a database with two log files, reproduces the error, shows which VLFs keep the file busy and frees it with log backups. It also explains why the file stays offline until the next log backup.

Read More