SQL Server emergency? Email pinal@sqlauthority.com with URGENT in the subject line.

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.

Continue Reading