Microsoft has released KB5065865, also known as Cumulative Update 21 (CU21) for SQL Server 2022, on September 11, 2025. This update brings critical bug fixes, security improvements, and stability enhancements for both Windows and Linux environments running SQL Server 2022.
If you are maintaining mission-critical databases, here’s everything you need to know before installing this update.
What is KB5065865?
KB5065865 is the 21st cumulative update for SQL Server 2022.
It updates the product version to 16.0.4215.2 and includes improvements for the SQL Server Database Engine and Analysis Services.
- File size: ~462 MB (Windows x64 installer)
- Applies to: SQL Server 2022 on Windows and Linux
- Build versions:
- SQL Server: 16.0.4215.2
- Analysis Services: 16.0.43.247
Key Fixes in KB5065865
This update includes 16 important fixes since CU20. Some highlights:
- Data corruption prevention
Fixes an issue withTRUNCATE TABLE WITH PARTITIONS
on non-aligned partitions that could cause corruption. - Availability group stability
Resolves assertion dumps triggered under certain Always On availability group trace conditions. - Security hardening
Addresses SQL injection vulnerabilities in system stored procedures and elevation-of-privilege bugs in login management. - Functional corrections
Fixes forTRY_CONVERT
returning invalid results in specific query plans.
Known Issues with KB5065865
While this update fixes many problems, it introduces at least one known issue:
SESSION_CONTEXT
with parallel queries
Queries that referenceSESSION_CONTEXT
in parallel query plans might return incorrect results or trigger access violation (AV) dumps.
If your workload relies heavily on parallel queries with SESSION_CONTEXT
, Microsoft recommends extra caution and thorough testing before deploying KB5065865 in production.
Installation & Deployment Notes
- Always test in a non-production environment before rolling out to production.
- Restart may be required for some SQL Server services after installation.
- If you use Always On availability groups, replication, or database mirroring, follow Microsoft’s official guidance to avoid disruptions.
- Download the update from the official Microsoft page.
Should You Install KB5065865?
Yes — this update is highly recommended for SQL Server 2022 administrators. It delivers security patches, data protection fixes, and stability improvements. However, keep in mind the SESSION_CONTEXT
bug, which could affect specific query workloads.
If you run large or critical environments, plan a staged rollout: test first, validate workloads, and then push to production.
Final Thoughts
KB5065865 (CU21) keeps SQL Server 2022 stable and secure, addressing major issues that could lead to corruption or vulnerabilities. While there is one known caveat with parallel queries, most database admins will benefit from applying this update as soon as possible.