Welcome to Microsoft Q&A!
Thank you for providing the details of your upgrade scenario. I am happy to share the recommended approach based on Microsoft guidance.
If Windows Server 2016 and SQL Server 2016 are installed on the same server, the recommended upgrade sequence is generally:
- Update SQL Server 2016 to SQL Server 2016 SP3 and the latest supported servicing level.
- Back up and validate the environment.
- Upgrade SQL Server 2016 SP3 to SQL Server 2022.
- Verify that SQL Server and all dependent applications are functioning correctly while the server is still running Windows Server 2016.
- Upgrade Windows Server 2016 to Windows Server 2022.
- Apply the latest Windows Server and SQL Server updates and perform a complete post-upgrade validation.
The reason for upgrading SQL Server first is to maintain a supported configuration throughout the transition:
- SQL Server 2022 is supported on Windows Server 2016.
- SQL Server 2016 is not supported on Windows Server 2022.
- A direct upgrade from SQL Server 2016 SP3 (or later) to SQL Server 2022 is supported.
- Windows Server 2016 can be upgraded directly to Windows Server 2022 through a supported in-place upgrade path.
Because of this, upgrading the operating system first would temporarily leave SQL Server 2016 running on Windows Server 2022, which is not a supported configuration.
Before proceeding, I strongly recommend:
- Verifying that your SQL Server edition and installed components support the upgrade path.
- Reviewing any dependencies such as Always On Availability Groups, Failover Cluster Instances, replication, SSIS, SSAS, SSRS, or third-party applications.
- Running a SQL Server upgrade assessment and checking for deprecated or discontinued features.
- Taking and verifying full backups of all user and system databases, including master, model, and msdb.
- Running DBCC CHECKDB and resolving any database integrity issues before upgrading.
- Documenting SQL logins, SQL Agent jobs, linked servers, credentials, certificates, service accounts, Database Mail settings, and application connection details.
- Preparing and testing a rollback or recovery plan. A VM snapshot should not be considered a substitute for SQL Server backups.
- Testing the complete upgrade process in a non-production environment whenever possible.
- Confirming that neither Windows nor SQL Server has a pending restart before beginning the upgrade.
Some of the main risks to consider include:
- Application or driver compatibility issues.
- Query plan or performance changes after the SQL Server upgrade.
- Deprecated or discontinued SQL Server features.
- Issues with SQL Server services, Agent jobs, linked servers, SSIS packages, or third-party monitoring and backup tools.
- Extended downtime or challenges during rollback if an in-place upgrade does not complete successfully.
- Availability Group, clustering, or replication-related issues in high-availability environments.
- Operating system, storage, network, antivirus, or hardware driver compatibility concerns during the Windows Server upgrade.
For business-critical production environments, a side-by-side migration to a new Windows Server 2022 server running SQL Server 2022 is often the safest approach. Although it requires additional planning and infrastructure, it provides more flexibility for testing and a much simpler rollback strategy if unexpected issues arise.
Finally, if this server participates in a SQL cluster, an Availability Group deployment, or hosts another Microsoft workload such as Configuration Manager, Exchange, or a third-party application, be sure to review the product-specific support matrix and upgrade guidance before proceeding.
I hope this helps clarify the recommended upgrade order and considerations.
References:
Version Requirements for SQL Server in Windows Operating System - SQL Server | Microsoft Learn
Supported Version and Edition Upgrades (SQL Server 2022) - SQL Server | Microsoft Learn
Plan Your Windows Server Upgrade Path | Microsoft Learn
Choose a Database Engine Upgrade Method - SQL Server | Microsoft Learn
Upgrade SQL Server - SQL Server | Microsoft Learn
In-place change of SQL Server edition - SQL Server | Microsoft Learn
SQL Server 2022 Release Notes - SQL Server | Microsoft Learn
If you find it useful, please click Accept Answer.
Thank you for choosing Microsoft Q&A.