Quantcast
Channel: Starting SQL Archives - SQL Authority with Pinal Dave
Viewing all articles
Browse latest Browse all 91

SQL SERVER – Unable to Start SQL Server After Patching

$
0
0

This is one of the common questions which lands in my mailbox via email about how to Start SQL Server after patch update.

Hi Pinal,
I have an issue on my UAT environment. I was unable to start the SQL server 2008 R2 instance after applying SP1. We see the following error logged in the SQL Application log

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 the upgrade of the ‘master’ database, it will prevent the entire SQL Server instance from starting. Examine the previous error log entries for errors, take the appropriate corrective actions and re-start the database so that the script upgrade steps run to completion.

Can you please help?

I have asked to share SQL Server ERRORLOG and here is what we found.

2015-12-10 12:20:20.20 spid7s      Error: 5123, Severity: 16, State: 1.
2015-12-10 12:20:20.20 spid7s      CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file ‘C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\temp_MS_AgentSigningCertificate_database.mdf’.
2015-12-10 12:20:20.20 spid7s      Error: 5123, Severity: 16, State: 1.
2015-12-10 12:20:20.20 spid7s      CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file ‘C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\temp_MS_AgentSigningCertificate_database.mdf’.
2015-12-10 12:20:20.20 spid7s      Error: 1802, Severity: 16, State: 4.
2015-12-10 12:20:20.20 spid7s      CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
2015-12-10 12:20:20.20 spid7s      Error: 912, Severity: 21, State: 2.
2015-12-10 12:20:20.20 spid7s      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.

If you don’t know where ERRORLOG is, then refer below blog.

SQL SERVER – Where is ERRORLOG? Various Ways to Find its Location

What is “Script upgrade mode”?

Based on my understanding, when we apply any patch on SQL Server instance, the patching, upgrades the system databases (views, objects) immediately after the restart of the SQL Server Services. The stopping of the services and starting it again is a part of the patching process.  There are certain scripts (most of the times sqlagentxxx_msdb_upgrade.sql) in the patch/SP which is applied only after the SQL Server service restarts. During the Process of applying these scripts if anyone tries to connect to SQL Server instance, then he/she will get the below error message.

Login failed for user ‘LoginName’: Reason: Server is in script upgrade mode. Only administrator can connect at this time.

I have also explained it in an earlier blog

SQL SERVER – Login Failed For User – Reason Server is in Script Upgrade Mode

So, here is our problem in this case.

CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file ‘C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\temp_MS_AgentSigningCertificate_database.mdf’.

I asked him to check the service account for SQL Server and it was set to the Network Service. When we checked permission on the folder C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSQLSERVER\MSSQL It did not have permissions for the Network Service account. I suggested to change this to Local System account OR provide permission, so that the SQLServer.exe process account (service account) will have permission and will be able to create the temp database and let the script upgrade complete.

Once permission was given the restart was successful.

Have you ever encountered any such issue of upgrade script mode?

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

First appeared on SQL SERVER – Unable to Start SQL Server After Patching


Viewing all articles
Browse latest Browse all 91

Trending Articles