Error during SQL Server 2008 R2 SP3 upgrade: MODIFY FILE failed. File 'MSDBLog' does not exist I have just installed SQL Server 2008 R2 SP3 and after installing it and trying to start the SQL Server instance again, it won't come online. In the SQL Server error log I can see that the following is logged:

2014-10-20 16:51:13.04 spid8s      MODIFY FILE failed. File 'MSDBLog' does not exist.
2014-10-20 16:51:13.04 spid8s      Error: 912, Severity: 21, State: 2.
2014-10-20 16:51:13.04 spid8s      Script level upgrade for database 'master' failed because upgrade step 'sqlagent100_msdb_upgrade.sql' encountered error 598, state 1, severity 25. This is a serious error condition which might interfere with regular operation and the database will be taken offline. If the error happened during upgrade of the 'master' database, it will prevent the entire SQL Server instance from starting. Examine the previous errorlog entries for errors, take the appropriate corrective actions and re-start the database so that the script upgrade steps run to completion.
2014-10-20 16:51:13.04 spid8s      Error: 3417, Severity: 21, State: 3.
2014-10-20 16:51:13.04 spid8s      Cannot recover the master database. SQL Server is unable to run. Restore master from a full backup, repair it, or rebuild it. For more information about how to rebuild the master database, see SQL Server Books Online.
2014-10-20 16:51:13.04 spid8s      SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.


How can I fix the upgrade so it doesn't fail?
This happens because the msdb log file name has been changed from the default which is "MSDBLog". In my case, it was called "msdb_log". The name "MSDBLog" is hard-coded into the upgrade script so it fails if the name has been changed.

To fix the problem, we need to rename the log file to 'MSDBLog'. We have to start SQL with trace flag 902 to stop it from running upgrade scripts when it starts. We can then do our fix, remove the trace flag and start it again.


Open SQL Server Configuration Manager
Navigate to "SQL Server Services" in the left-hand pane
Right click on the SQL instance and select "Properties"
Click on the "Advanced" tab
In "Startup Parameters", add ";-T902" to the end (excluding quotation marks)
Click "OK" to save it
Start the SQL instance
Rename the log file back to its original name:

ALTER DATABASE msdb MODIFY FILE (NAME=N'msdb_log', NEWNAME=N'MSDBLog')
Stop the SQL instance
Undo the changes to the startup parameters
Start the SQL instance again


The upgrade scripts will now run and should succeed.