Installing service pack / cumulative update on SQL Server 2016 / 2017 breaks database engine
This only happens on Windows 10, when the setting "Beta: Use Unicode UTF-8 for worldwide language support" in Region Settings is checked.
SQL Server update fails and Database engine cannot be started normally (it tries to update master db when it starts and because it fails, the service is shut down. Database engine can only be started using the T902 flag, i.e. ignoring updates when starting).
The messages from the error log are quite misleading, starting from the outermost:
"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."
And then the following "details":
"Script level upgrade for database 'master' failed because upgrade step 'msdb110_upgrade.sql' encountered error 200, state 7, 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."
"The code page 65001 is not supported by the server."
This happens actually when executing the following update script:
I lost two days installing, uninstalling and then reinstalling SQL Server 2016 / 2017 Developer edition. Only the RTM releases installed OK, but trying to update using either SP1 / SP2 or cumulative update, the Database engine was left in non-working state.
Comparing the OS settings with another colleague's Windows 10, who didn't have problems with SQL Server updates, it occurred that the only "system" difference was the above mentioned option: "Beta: Use Unicode UTF-8 for worldwide language support" - it was not selected.
Once clearing the option "Beta: Use Unicode UTF-8 for worldwide language support" on my machine and restarting, the Database engine managed to update itself successfully.
It would be nice for the installer to check for this condition and provide some meaningful way to warn the user about the implications of having the option "Beta: Use Unicode UTF-8 for worldwide language support" selected.
Attached is the error log (hostname and user database names are censored).
Jaap van Beusekom commented
Wow, saved me more then 2 days searching!
Many many many thanks
waw its magically work in sql 2017 was given the me same error message and i spend 2 days try find solutions i was seconds far from uninstall and rebuild my project thank you to save my time
2 days on this issue.
Great and deep analysis.
Thank you! I truly appreciate this. I just spent 2 days troubleshooting this exact issue. Re-installed SQL 2016 SP2 about 10 times, trying different methods. In the end this was my fix.
Amazing! Thanks a lot!! I tried all the solutions which I found and they didn't help me. Thank you!
Shane Johnson commented
Thank you so much for posting this. You saved my day!