Issues when upgrading to SQL Server 2022

Applies to:  SQL Server 2022, SQL Server 2019, SQL Server 2017, SQL Server 2016

This article provides steps to troubleshoot and resolve the following common issues when performing an upgrade to SQL Server 2022.

An error related to access violation dumps occurs when you perform an upgrade to SQL Server 2022 in an Always On environment. The error message and associated log entries indicate a fatal exception generated during the upgrade process.

Error message:

Exception Code: c0000005 EXCEPTION_ACCESS_VIOLATION

Application event log:

Error: A user request from the session with SPID <SPID> generated a fatal exception. SQL Server is terminating this session.
Information: Windows Error Reporting - Fault bucket INVALID_REQUEST, type 0

SQL Server error log:

Error: A user request from the session with SPID <SPID> generated a fatal exception. SQL Server is terminating this session. Contact Product Support Services with the dump produced in the log directory.

Resolution:

There's a known issue with LIGHTWEIGHT_QUERY_PROFILING in SQL Server 2022.

This issue has been fixed in Cumulative Update 4 for SQL Server 2022 and Cumulative Update 20 for SQL Server 2019.

Workaround:

To work around this issue, disable LIGHTWEIGHT_QUERY_PROFILING. The lightweight profiling can be disabled at the database level using the LIGHTWEIGHT_QUERY_PROFILING database scoped configuration: ALTER DATABASE SCOPED CONFIGURATION SET LIGHTWEIGHT_QUERY_PROFILING = OFF;.

You're unable to upgrade to SQL Server 2022 due to an inactive instance for SQL Server 2022.

Cause:

This problem occurs when a previous installation of SQL Server fails, leaving behind a partially installed instance on the computer. The SQL Server setup program doesn't automatically roll back the installation if there's a failure. The partially installed instance doesn't include the edition of SQL Server you were trying to install, leading to subsequent installation failures when attempting to upgrade to the same version.

Resolution:

To resolve this issue, follow the steps mentioned in Remove a partial installation of SQL Server.

Issue 3: The failover cluster instance fails to come online

After upgrading SQL Server from an earlier version to 2022 on a failover cluster instance (FCI), you may encounter a situation where the instance fails to come online. When checking the FCI role on the cluster manager, you notice that the instance is unable to start.

Possible cause:

One possible cause of this issue is that the SQL Server instance might be in the script upgrade mode, which prevents it from starting. During the upgrade process, SQL Server goes through several steps to ensure a smooth transition, including executing upgrade scripts. If the instance is stuck in the script upgrade mode, it won't be able to come online.

Workaround:

To resolve the issue and bring the SQL Server instance online successfully, you can bypass the running upgrade script by following the steps in Troubleshoot upgrade script failures when applying an update.

Note

The -T902 parameter disables the upgrade script execution during startup.

An error related to replication occurs when you upgrade to SQL Server 2022 on machines that host the distribution database in an availability group (AG).

Note

This issue can also occur when you upgrade SQL Server from version 2016 SP2 CU3, SQL Server 2017 CU6, or later versions to SQL Server 2019. The fix for this issue is available in Cumulative Update 21 for SQL Server 2019.

Error message:

SQL setup completes but shows the error "There was an error executing the replication upgrade scripts" for the replication component. If you try to run a repair on an instance in this state, you'll receive the same error message.

SQL Server error log:

Executing sp_vupgrade_replication.
Could not open distribution database <distribution_db_name> because it is offline or being recovered. Replication settings and system objects could not be upgraded. Be sure this database is available and run sp_vupgrade_replication again.
Error executing sp_vupgrade_replication.
Saving upgrade script status to 'SOFTWARE\Microsoft\MSSQLServer\Replication\Setup'.

Cause:

The error occurs when the distribution database is part of an AG, and an in-place upgrade is attempted.

Resolution:

The fix for this issue is available in Cumulative Update 5 for SQL Server 2022.

Workaround:

To work around this issue, follow these steps:

  1. Remove the distribution database from the AG.
  2. Proceed with the upgrade to SQL Server 2022.
  3. After completing the upgrade, add the distribution database back to the AG.

More information