SQL SERVER – Script level upgrade for database ‘master’ failed because upgrade step msdb110_upgrade.sql encountered error 926, state 1, severity 25

SQL
2 Comments

SQL SERVER - Script level upgrade for database 'master' failed because upgrade step msdb110_upgrade.sql encountered error 926, state 1, severity 25 warning-1 I have helped many clients in upgrade failures via my On-Demand consulting and I am amazed to see various ways which can break SQL Server upgrade. In this blog we would learn about fixing error Script level upgrade for database ‘master’ failed because of upgrade step sqlagent100_msdb_upgrade.sql

Below are few earlier blogs which have other causes of same error:

SQL SERVER – Script level upgrade for database ‘master’ failed because upgrade step ‘sqlagent100_msdb_upgrade.sql’

SQL SERVER – Script level upgrade for database ‘master’ failed – There is already an object named ‘DatabaseMailUserRole’ in the database

SQL SERVER – Script level upgrade for database master failed – Error: 4860, Severity: 16, State: 1 – Cannot bulk load. SqlTraceCollect.dtsx does not exist

Solarwinds

SQL SERVER – Error 15559 – Error 912 – Script Level Upgrade for Database ‘master’ Failed

SQL SERVER – Script Level Upgrade for Database ‘master’ Failed Because Upgrade Step ‘sqlagent100_msdb_upgrade.sql’ – Error: 5041: MODIFY FILE Failed

As I mentioned in an earlier blog, we need to look at the exact error in ERRORLOG. In my client’s case, here is what I saw in ERRORLOG.

  1. Error: 8355, Severity: 16, State: 1.
  2. Server-level event notifications cannot be delivered. Either Service Broker is disabled in msdb, or msdb failed to start. Event notifications in other databases could be affected as well. Bring msdb online, or enable Service Broker.
  3. Error: 926, Severity: 14, State: 1.
  4. Database ‘msdb’ cannot be opened. It has been marked SUSPECT by recovery. See the SQL Server errorlog for more information.
  5. Error: 912, Severity: 21, State: 2.
  6. Script level upgrade for database ‘master’ failed because upgrade step ‘msdb110_upgrade.sql’ encountered error 926, 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.
  7. Error: 3417, Severity: 21, State: 3.
  8. 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.
  9. SQL Server shutdown has been initiated
  10. SQL Trace was stopped due to server shutdown. Trace ID = ‘1’. This is an informational message only; no user action is required.

I have put line number for clarity. Message in line number 7 onwards are scary and don’t trust/follow them. Upgrade failure is in line number 5 and 6. If you read complete message in line number 6, it tells error 926 encountered. Now, line number 3 is error number 926 which means database msdb can’t be opened.

WORKAROUND/SOLUTION

As mentioned in all earlier articles, we need to start SQL Service with trace flag 902 to bypass upgrade script and fix the cause of upgrade script failures. So, here are the steps I have done.

As I mentioned earlier, first we started SQL with trace flag 902. I started SQL using trace flag 902 as below via command prompt.

NET START MSSQLSERVER /T902

For named instance, we need to use below (replace instance name based on your environment)

NET START MSSQL$INSTANCENAME /T902

Refer: SQL SERVER – 2005 – Start Stop Restart SQL Server from Command Prompt

As soon as SQL was started, we were able to connect because upgrade didn’t run. Now, we need to fix issue i.e. fix the reason of MSDB suspect database. In my client’s situation, we restore to last known good backup of MSDB database. Once restore was completed, we stopped SQL Service and started normally (without any trace flag). This time upgrade scripts ran fine, and SQL was up and running.

Have you faced any other upgrade script failures? I would be happy to write a blog, if not written already, with due credit.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Solarwinds
, , , ,
Previous Post
SQL SERVER – Unable to Start Service SQLSERVERAGENT on Server (mscorlib)
Next Post
SQL SERVER – AlwaysOn – Queries Waiting for HADR_AR_CRITICAL_SECTION_ENTRY

Related Posts

2 Comments. Leave new

  • Very good article. thank you very much for the help

    The way that we fix this problem is to
    A: Start SQL Server with the T902 Flag
    B: Find the actual script msdb110_upgrade.sql in the Program folder for SQL Server
    C: Copy the entire script into SQL Server and execute it.
    D: We find the error generated – line number and go to that part of the script. Usually we have to — REM out the offending code which in our case is usually
    EXEC sp_configure ‘show advanced options’ ,@advopt_old_value;
    and
    EXECUTE #sp_enable_component ‘Agent XPs’, @advopt_old_value out, @comp_old_value out
    E: We then copy the updated script into a new query window – this part is important because if you rerun the script in the same window the entire thing fails – and run it again to make sure it works
    F: We then take the updated script and replace the content of the msdb110_upgrade.sql file in the program folder
    G: We then remove the T902 flag and restart the instance.

    Reply
  • Joginapally Vivek
    April 24, 2019 1:59 pm

    Thank you so much , you saved my production server

    I performed the SP3 upgrade to 2014 SQL Server, However i was unable to start my SQL Services from Configuration manager.

    I checked this article, and i run the following commands in the command prompt:

    NET START MSSQLSERVER /T902 ( As my instance is default instance)

    Immediately SQL Services started successfully.

    I hope my case helps for some, who experience the same.

    Once again thanks for this article.

    Thanks & Regards,
    Vivek Joginapally
    SQL Server DBA

    Reply

Leave a Reply

Menu