We recently got an opportunity to update our MS SQL server as the current version was going out of support. So we noted down all the steps and issues faced during this activity.
We will be updating our database from SP1 to SP2 latest version. You can check the latest version for MS SQL 2016 here.
Download the SP2 version 13.0.5026.0 and then the latest cumulative update available at that time.
Pre-requisite steps
Stop your SAP system which is connected to this database using the SAP Management console and take a complete backup.
![SAP Management console --> Stop SAP system](https://sapissues.com/wp-content/uploads/2021/06/image-92.png)
First, we will update the database to SP2. So, right-click on the “SQLServer2016SP2-KB4052908-architecture-language.exe” file and select ” Run as Administrator”
MS SQL server installation screens
Click on accept license terms and Privacy Statement and click “Next”
![MS SQL server 2016 setup --> Accept the license terms](https://sapissues.com/wp-content/uploads/2021/06/image-91.png)
Select all the instances
![MS SQL server 2016 setup --> Select Features](https://sapissues.com/wp-content/uploads/2021/06/image-93.png)
In step “Check Files in Use”, it may ask to stop the “WmiPrvSE.exe” process manually. That we can do using “Task Manager”. Then click on “Refresh check” to check the files again. But sometimes, this will keep appearing. So you can ignore it and click “Next”.
![MS SQL server 2016 setup --> WmiPrvSE.exe process is not controlled by the update wizard. You have to manually stop this process to avoid a computer restart.](https://sapissues.com/wp-content/uploads/2021/06/image-94.png)
On the Next screen, the Summary is displayed. Just verify and continue to the next screen.
![MS SQL server 2016 setup --> Ready to update](https://sapissues.com/wp-content/uploads/2021/06/image-95.png)
The update will start and we can see the progress here.
![MS SQL server 2016 setup --> update progress](https://sapissues.com/wp-content/uploads/2021/06/image-96.png)
Once done, you should a completion screen as below.
![MS SQL server 2016 setup --> Setup complete](https://sapissues.com/wp-content/uploads/2021/06/image-97.png)
Close this window and restart the complete windows server. Otherwise, it will not allow starting the installation of the cumulative update.
Post restart, follow the same steps for the cumulative file of the latest version available.
Issues faced while updating MS SQL server
You may face the below error where the Database Engine Services (MSSQLSERVER) fails because the registry keys are not defined correctly
Error installing SQL Server Database Engine Services Instance Features
The User Data directory in the registry is not valid. Verify DefaultData key under the instance hive points to a valid directory.
![MS SQL server 2016 setup -->Database Engine Services (MSSQLSERVER) Failed](https://sapissues.com/wp-content/uploads/2021/06/image-98.png)
Open the “Regedit” application as an administrator. So that we can check and correct the below registry keys required for this setup
DefaultData –> Pointing to <MS SQL directory>\Data
DefaultLog –> <MS SQL directory>\Log
SQLDataRoot
DefaultData and DefaultLog both reside under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MIcrosoft SQL Server\MSSQL.<version no.>.MSSQLSERVER\MSSQLServer
In my case, the value for DefaultLog was incorrect. Instead of pointing to Log, it was mentioned as “Data”. So we had to correct this value and save the key.
![Registry keys](https://sapissues.com/wp-content/uploads/2021/06/image-99-1024x429.png)
SQLDataRoot is present under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MIcrosoft SQL Server\MSSQL.<version no.>.MSSQLSERVER\MSSQLServer\Setup
Now re-run the setup file. Once Succeeded, Restart the complete server.
![](https://sapissues.com/wp-content/uploads/2021/06/image-100.png)
Verification
We can verify the MSSQL version using MS SQL Management Studio. Now, you may restart the SAP application again.