Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Summary
Use this article to troubleshoot a failed cumulative update (CU) or service pack (SP) installation on Microsoft SQL Server on Windows. It shows you how to read the SQL Server Setup logs to isolate the failure, and provides solutions for each common cause. The covered causes are failed database upgrade scripts (errors 912 and 3417), missing Windows Installer cache files, invalid data or log directories in the registry, and misconfigured Windows Server Failover Clustering (WSFC) nodes.
Find your error message or symptom
The following table maps the error messages and symptoms of a failed SQL Server CU or SP installation to the likely cause and the section that describes the fix.
| Error message or symptom | Likely cause | Solution |
|---|---|---|
Wait on Database Engine recovery handle failed in Setup, and errors 912 and 3417 in the SQL Server error log |
The T-SQL database upgrade scripts failed to run after Setup replaced the SQL Server binaries | Errors 912 and 3417 |
The cached MSI file ... is missing, Unable to open Windows installer file, or No valid sequence could be found for the set of updates. Error code 1648 |
Missing MSI or MSP (Windows Installer package or patch) files in the Windows Installer cache | Missing installer files |
The User Data directory in the registry is not valid, The User Log directory in the registry is not valid, or The Database Engine system data directory in the registry is not valid |
Incorrect DefaultData, DefaultLog, or system data directory values in the registry |
Invalid data or log directory |
The network path was not found or System.UnauthorizedAccessException: Attempted to perform an unauthorized operation, or an update that takes a long time or stops responding |
The Remote Registry service is stopped, or administrative shares are disabled, on a node of an Always On failover cluster instance (FCI) or availability group | Misconfigured WSFC nodes |
Requirements for installing a SQL Server CU or SP
Check the following requirements before you apply a CU or SP. A failed installation often traces back to one of them.
Which CU can I install on SQL Server 2017 and later versions?
For Microsoft SQL Server 2017 (14.x) and later versions, you can always apply the latest CU that's available. No service packs exist for SQL Server 2017 and later versions.
Which CU can I install on SQL Server 2016 and earlier versions?
Before you install a CU, make sure that your SQL Server instance is at the right SP level for that CU. For example, you can't apply CU17 for SQL Server 2016 SP2 before you apply SP2 for the SQL Server 2016 instance.
You can always apply the latest CU for a given SP baseline without having to apply previous CUs for that service pack. For example, to apply CU17 for a SQL Server 2016 SP2 instance, you can skip CU14, CU15, and CU16, if they aren't installed, and apply CU17 directly.
Note
SQL Server 2016 (13.x) has reached end of support. To continue receiving security updates, see SQL Server end of support options.
Where can SQL Server program files and data files be installed?
Before you apply a CU or SP, make sure that the instance that you're updating is correctly installed. The SQL Server program files and data files can't be installed on:
- A removable disk drive.
- A file system that uses compression.
- A directory in which system files are located.
- Shared drives on a failover cluster instance.
How do I update a database engine feature that I add after a CU or SP?
If you add a database engine feature after you apply a CU or an SP to an instance, update the new feature to the same level as the program instance before you apply any new CUs or SPs.
Find the cause of a SQL Server CU or SP setup failure
To isolate the error, use the SQL Server Setup log files. Setup writes them to the %programfiles%\Microsoft SQL Server\nnn\Setup Bootstrap\Log folder, where nnn corresponds to the SQL Server version.
- Select Details from the setup process's Failure screen.
- In the %programfiles%\Microsoft SQL Server\nnn\Setup Bootstrap\Log folder, check Summary.txt under the Product features discovered section to determine whether any of the listed features report a failure. If they do, you can focus on resolving problems that affect that feature.
- Go to the subfolder that's named yyyyMMdd_HHmmss (for example 20220618_174947) that corresponds to the reported failure time that you are focusing on. The goal is to examine the feature-specific files, ERRORLOG files, and Detail.txt file, if necessary.
- Go to the \MSSQLSERVER subfolder, and locate the log files that are specific to the feature that failed. For example, sql_engine_core_inst_Cpu64_1.log. For upgrade script failures, check the SQLServer_ERRORLOG_date_time.txt files that correspond to the time of the upgrade failure.
- Open the Detail.txt log file, and search on the keyword "Failed." Not every failure is considered critical.
For more information about each log file, see View and read SQL Server Setup log files.
In the next sections, find the scenario that corresponds to your situation, and then follow the associated troubleshooting steps. If there's no matching scenario, look for more pointers in the log files.
Errors 912 and 3417 and "Wait on Database Engine recovery handle failed"
Applies to: a CU or SP installation that fails while Setup runs the database upgrade scripts.
T-SQL upgrade scripts are shipped together with every SQL Server cumulative update. They're run after the SQL Server binaries are replaced with the latest versions. If these T-SQL scripts don't run for some reason, the Setup program reports the following error:
Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes.
Setup records errors 912 and 3417 in the latest SQL Server error log. Error 912 (Script level upgrade for database '...' failed) indicates a database upgrade script failure. Error 3417 (Cannot recover the master database) indicates that SQL Server couldn't recover the master database. The messages that precede error 912 usually provide information about the root cause of the failure that occurred when the upgrade scripts were run.
A variety of errors can be raised together with 912 and 3417. For a summary of common scenarios and related solutions, see Troubleshoot upgrade script failures when applying an update. If SQL Server doesn't start after the update finishes, also see Service may not start after patch installed.
Setup errors caused by missing installer files in the Windows Installer cache
Applies to: a CU or SP installation, repair, or uninstall that fails because MSI or MSP (Windows Installer package or patch) files are missing.
Applications such as SQL Server that use Windows Installer technology for the setup process store critical files in the Windows Installer cache. The default installer cache location is C:\Windows\Installer. These files are required for uninstalling and updating applications. They're unique to that computer.
Updates to applications that depend on these files won't work if the files are accidentally deleted or otherwise compromised. Typical symptoms are messages such as The cached MSI file 'C:\Windows\Installer\xxxxxx.msi' is missing or No valid sequence could be found for the set of updates. Error code 1648.
To resolve this condition, use one of the methods described in Restore the missing Windows Installer cache files.
Setup fails because of an incorrect data or log directory in the registry
Applies to: a CU or SP installation that fails because the default data or log directory, or the system data directory, in the registry is invalid.
When you install a CU or SP, if the default data and log folders are invalid, you might receive errors that resemble the following messages:
"The User Data directory in the registry is not valid. Verify DefaultData key under the instance hive points to a valid directory."
"The User Log directory in the registry is not valid. Verify DefaultLog key under the instance hive points to a valid directory."
"Error installing SQL Server Database Engine Services Instance Features. The Database Engine system data directory in the registry is not valid."
To fix this issue, follow these steps:
- Connect to the SQL Server instance by using SQL Server Management Studio (SSMS).
- Right-click the SQL Server instance in the Object Explorer and select Properties > Database Settings.
- Under Database Default locations, make sure that the folders in Data and Log are correct.
- In the SQL Server Configuration Manager, select SQL Server Services, double-click the affected SQL Server Service, select the Advanced tab, and make sure the value of Data Path is correct. The value is grayed out and can't be modified. However, if you want to correct it, follow Method 2 in Error that Data or Log directory in the registry is not valid when installing SQL Server Cumulative Update or a Service Pack to modify the SQLDataRoot registry entry.
- Retry the CU or SP installation.
Misconfigured Windows Server Failover Clustering (WSFC) nodes
Applies to: a CU or SP installation on a SQL Server failover cluster instance (FCI) or on replicas of an Always On availability group that run on WSFC nodes.
For smooth functioning and maintenance of a SQL Server FCI, follow the best practices described in Before Installing Failover Clustering and Failover Cluster Instance administration & maintenance.
If you experience errors when you apply a CU or an SP, check the following conditions:
- Make sure that the Remote Registry service is active and running on all nodes of the WSFC cluster.
- If the service account for SQL Server isn't an administrator in your Windows cluster, make sure that administrative shares (C$ and so on) are enabled on all of the nodes. For more information, see Overview of problems that may occur when administrative shares are missing.
If these shares aren't configured correctly, you might notice one or more of the following symptoms when you try to install a CU or SP:
The update takes a long time to run or doesn't respond. Setup logs don't reveal any progress.
Setup logs contain messages such as the following:
The network path was not found.System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.
Additional information
- For a complete list of currently available updates for your SQL Server version and download locations, see Determine the version, edition, and update level - SQL Server.
- For more information about supportability and servicing timelines for your SQL Server version, see Microsoft Product Lifecycle Page.
- For information about servicing models for different versions of SQL Server, see Servicing models for SQL Server.
- For general information about how to update SQL Server, see Install SQL Server servicing updates.
- For information about security updates for SQL Server and other products, see Security Update Guide.
- To resolve setup issues that might occur in highly secure environments, see SQL Server installation fails if the Setup account doesn't have certain user rights.