Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

I experienced the same error recently with upgrading SQL 2012 to SP2:

2014-11-08 23:49:55.49 spid5s      Checking the size of MSDB...
2014-11-08 23:49:56.13 spid5s      Error: 5041, Severity: 16, State: 1.
2014-11-08 23:49:56.13 spid5s      MODIFY FILE failed. File 'MSDBLog' does not exist.
2014-11-08 23:49:56.13 spid5s      Error: 912, Severity: 21, State: 2.
2014-11-08 23:49:56.13 spid5s      Script level upgrade for database 'master' failed because upgrade step 'msdb110_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-11-08 23:49:56.13 spid5s      Error: 3417, Severity: 21, State: 3.
2014-11-08 23:49:56.13 spid5s      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-11-08 23:49:56.13 spid5s      SQL Server shutdown has been initiated
2014-11-08 23:49:56.13 spid5s      SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.

You'll note that the message is slightly different, but the key to resolving it was the "MSDBLog does not exist". I wanted to ensure that I added this specific message to this question/answer as it didn't come up when I was searching for one of the other errors, since it is slightly different from the SQL 2008 SP3 upgrade. I'm hoping by adding this here, it will help future people running into this problem with SQL 2012 find this page.

Thanks to Richard, I was able to resolve the issue by modifying the logical file name of the msdb to match it's physical name. Unfortunately, I do not have enough reputation to upvote/comment on his answer, but still felt it was important to get MY error message added to this page for future searches.

I now check to ensure the MSDB is properly named (physically and logically) before starting an upgrade. Good luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top