r/SQLServer • • Jul 21 '25

In-place OS upgrades of SQL Server 2022 Always-On Cluster Nodes

26 Upvotes

We recently upgraded several Windows Server 2016 nodes that were part of a six (6) node SQL 2022 Always-On Cluster. This process is poorly documented by Microsoft, so we wanted to post the information that we learned from this successful upgrade experience for others.

The basic principle for an OS upgrade is as follows:

  • Windows Cluster Failover severs can only be upgraded one OS version at a time so if your SQL Servers are in a Windows Server 2016 cluster, as ours were, you have to take each of the Windows Server nodes to Windows Server 2019, then upgrade the cluster version using a Powershell script, before you can proceed to upgrade all of the nodes again to Windows Server 2022, upgrade the cluster version again, and then on to Windows Server 2025, if this is what you intend to upgrade to. Follow the Windows Cluster Failover rolling upgrade documentation for details on this process of upgrading the OS on a WFC cluster node. https://learn.microsoft.com/en-us/windows-server/failover-clustering/cluster-operating-system-rolling-upgrade

  • The version of SQL Server you are running has to be compatible with both the Windows OS the node is currently running and the Windows OS that you want to upgrade the node to.

  • Only upgrade a single Windows node at a time to limit the potential impact to the cluster if a recovery of the database is required on the node being upgraded.

  • SQL Server LOG backups must be paused before the OS upgrade starts for the entire AG so that missing transactions can be replayed when the node is re-joined to the AG.

  • Remove the node that is being upgraded from the AG and join it back to the AG once the node has been upgraded.

  • Remove the node that is being upgraded from the windows cluster and join it back to the cluster once the node has been upgraded.

  • As long as the SQL LOGS haven’t been truncated by a LOG backup then the databases will automatically re-synchronize when the node is added back to the AG. The status of the databases should always show “Synchronizing” or “Synchronized” once the node is added back to the AG and never “Recovering…” or “In Recovery…” if you see anything other than “Synchronizing” or “Synchronized” then you need to restore the databases to the node to get database back in sync with the AG again.

  • Resume SQL LOG backups once the node has been added back to the AG.

As a general part of Windows OS Upgrades and not specific to Windows Failover Services or SQL Always-On Availability Groups follow these guidelines.

  • Remove any antivirus software prior to upgrading the OS then re-install after the OS upgrade is complete.

  • Confirm that all of the software installed on the server is compatible with the Windows OS you are upgrading to. Most of the time this isn't an issue but occasionally it can be a problem. It's best to confirm as much as you can or uninstall incompatible software if it's no longer required.

  • Make note of the version of .Net Framework installed prior to the OS upgrade. Occasionally during an OS upgrade the .Net Framework version will be downgraded during the OS upgrade, because the OS being upgraded to comes pre-installed with an older build of the .Net Framework then what was applied to the Windows Server you are upgrading from. So, you may need to re-install that specific version of the .Net Framework again after upgrading the Windows OS. So, you will need to make note of the version of .Net that is installed so that you can confirm that this version (or newer) is installed after the in-place upgrade is complete. Usually, the easiest way to tell is to look at mscorlib.dll in C:\Windows\Microsoft.NET\Framework64\v4.0.30319 and record the file version. Also record the Net 4.0 Release version which comes from the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full registry key. Look at the Release registry value to confirm the .Net release. After the upgrade the Release registry key needs to be same or higher than what was originally installed. The Release gets updated with .Net major version and security patches.

  • Make note of the server IP address and confirm that it doesn’t change during the in-place upgrade. This can occur in instances where the NIC switches from static IP to DHCP.

  • Update VMWare Tools or any other hypervisor specific tools or drivers to the latest version, if it’s not current.

  • You need 60GB of free space on the OS volume to have sufficient space for the OS upgrade.

Here are the detailed steps that we used to perform the Windows OS upgrades of each of the WFC cluster/SQL Server AG nodes:

  1. Stop log backups of the SQL Availability Group.  Confirm that log backups are not currently running by reviewing the ERRORLOG on both the primary and read-only secondary synchronous replicas.

  2. Pause data moment from the primary.

  3. Remove the node that is being upgraded from the AG.

  4. Resume data movement from the primary.

  5. Stop and disable SQL Server on the node that's being upgraded.

  6. Remove the node from the windows cluster for the node that's being upgraded. 

  7. Power down and snapshot the server that's being upgraded.

  8. Perform OS upgrade and apply all OS updates. 

  9. Rejoin the node to the windows cluster.

  10. Enable SQL server services again and start up SQL Server services on the node that's being upgraded. 

  11. Rejoin the node to the SQL Availability Group and resume all databases. All databases should show "synchronizing" or "synchronized" again.

  12. Resume SQL log backups. 

Confirm how far behind the databases that are synchronizing are by running the SQL script in step #8 from the article below.

https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/availability-groups/troubleshooting-alwayson-issues

Overall, this processed worked extremely well for us, so we wanted to post the details for anyone else who might be interested.


r/SQLServer • • Mar 17 '25

Why is it so hard to import CSVs?

26 Upvotes

Bit of background to add context to this rant: I'm a senior SQL dev with more than 10 years' experience, 7 of which have been spent in the Microsoft stack.

I have written fairly advanced data pulls from Oracle, APIs, odata sources, etc. using various techniques including SSIS, linked servers, Polybase.

The point is, I'm not new and there's not much that phased me anymore.

However, one thing that never fails to go wrong every time I try it is the very simple task of working with CSVs.

If I use SSIS, I have to know the data types and have a table set up ready for ingestion.

If I want to have a table setup ready for ingestion, the easiest way to do that is using the import wizard.

However, this always seems to mis-detect the data types and fail.

So we build custom methods using bcp, bulk insert, openrowset, etc. however these are all fairly annoying to setup on an ad-hoc basis, so you invest the time on a solution that will work with any CSV you throw at it, however you can't do that unless you have a format file or schema.ini file telling you the data types.

So you test some awful solution involving string splits which finally works, except it doesn't scale so can't be used in case someone throws a giant CSV at it and breaks your server.

Is it really this bad or did I miss a vital day 1 lesson at data school? How are people creating tables for new CSVs without raging in frustration?


r/SQLServer • • Oct 09 '23

Most common answers to DBA support problems

26 Upvotes

As a retired DBA, I'm trying to think of the most common repeated answers that I had to provide through the years. The biggest frequent flyers that I recall:

  • Don't run that big fat process when (reboots/weekly maintenance/your other big fat process) is running.

  • Don't run that periodic process every 5 seconds.

  • You need (more/at least some) indexes

  • Do you really need to retain 12 years of log data in that table?

  • Someone offshore is running Select * on that table with 12 years of log data.

Curious to see what others have encountered...


r/SQLServer • • Jul 13 '23

The nightmare scenario has occurred; I'm now the only on call DBA on my team, 365 days a year.

26 Upvotes

A couple days ago, my co-DBA resigned, frustrated with the larger IT team and dysfunction. Prior to him leaving (and I didn't know he was leaving), I had told our manager in an long overdue 1 on 1, to hire another SQL Server DBA and/or Oracle with SQL Server knowledge (we inherited an Oracle ecosystem), because I eventually want to transition out of this team. Back then, two weeks on, two weeks off, was disrupting my sleep and social life, where most alerts were false positives., or I get pings from overseas on Teams. Working on setting my Teams to do not disturb, except for only members of the IT team who need to escalate.

Starting next week Friday, I now become the full time on call DBA that the rest of our IT team escalates SQL problems to. So obviously I've started applying for jobs outside the company (was already doing it before the resignation), to at least a lateral move to a large organization, where on-call is much less. Our company is too small for me to change departments/locations. A former manager also reaching out to me to see if I'm interested in SRE work as I have a lot of exposure with disparate systems that connect with SQL and the general flow of data (Data Engineering "light" I call it), and honestly a change of pace would be welcome.

But for now, I have to grin and bare it for at least a few weeks, until vacation in Europe.

How's everyone else's day? Please tell me your nightmare scenario that came to pass. Looking to be optimistic after these first few weeks of hell. 🙃


r/SQLServer • • May 01 '23

SQLMaestros or Brent Ozar master classes

26 Upvotes

I'm looking to do a deep dive to understand SQL Server for query optimization better. SQLMaestros and Brent Ozar courses came up as front runners from my limited research.

https://sqlmaestros.com/sql-server-master-classes-recordings/

https://training.brentozar.com

SQLAuthority also has a wealth of information but I could not find a well-structured course

https://blog.sqlauthority.com

Do you have any recommendations on the preferred course/material?

Edit: I ended up purchasing SQLMaestros and immediately regretted it. The portal to view videos is absolutely terrible with wonky and tiny video display that you have no control over. Nothing like watching YouTube videos. No refunds offered even a few days after the purchase. I ended up not watching any of the content.


r/SQLServer • • Jan 11 '23

Crying Screams in SQL.....

26 Upvotes

One wrong line of code in a Stored Proc has just cost me three days of debugging time...
I want to cry...


r/SQLServer • • Nov 03 '22

Community Share [Bitesized] Hash Indexes

Post image
26 Upvotes

r/SQLServer • • Jun 16 '21

Question Things you wish you knew about SQL Server before building an app?

26 Upvotes

As a frontend or fullstack developer, what are some things you wish you knew about databases, especially SQL Server, for building an app.

This could be anything like using connection strings, using the right data types, CLI tools, user Grants, GUI, writing optimised queries, adding indexes for performance, how SQL views can be leveraged etc.


r/SQLServer • • Jun 04 '21

Rant Today I found out my new employer is still supporting 2008 because 3 clients refuse to upgrade...

26 Upvotes

...but we have no QA environment for 2008/Compat lvl 100. All of my sql development has to be dumbed down and optimized for lvl 100. The kicker is that they had me make many optimizations and other changes to the application sprocs, but completely neglected to tell me that while 99% of our client base is at 2016 or higher, we have to develop for 2008.

When I left my old position, I was glad to have finally moved to an instance that's newer than 2012.... alas.

If you hear unnerving sounds, don't worry; that's just me screaming into the void.


r/SQLServer • • Jun 17 '20

Blog Released: General Availability of Microsoft.Data.SqlClient 2.0

Thumbnail
techcommunity.microsoft.com
26 Upvotes

r/SQLServer • • Jan 12 '20

how I studied for and passed 98-364 with no SQL experience

26 Upvotes

I watched the basic Khan academy videos to get a really basic understanding of SQL. I was starting with essentially 0 knowledge.

I made this study guide, which I'll leave here: https://docs.google.com/document/d/1qqtAXFp4CHdtkdL-iAT1XWtwmu41nfSOlJhTwepuuOo/edit?usp=sharing.

I made this guide using the Microsoft book, which, as many have noted, is pretty unhelpful.

I also looked at test dumps, which was far more helpful than the book. I would recommend book + test dumps.


r/SQLServer • • Nov 27 '19

After months of wrestling with the ADR whitepaper...

26 Upvotes

I was able to draw enough pretty pictures to make my very first article! Oh yeah, there are some words too. Ten animations and a couple thousand words to give an introduction to ADR.

https://www.red-gate.com/simple-talk/sql/database-administration/how-does-accelerated-database-recovery-work/

Uh, yeah, awkward self-promotion over. *stares at shoelaces*


r/SQLServer • • Oct 30 '19

APPLY - Your New Best Friend

Thumbnail sqlsorcery.com
26 Upvotes

r/SQLServer • • Oct 15 '19

Blog How to Think Like the SQL Server Engine: The Perils of SELECT *

Thumbnail
brentozar.com
26 Upvotes

r/SQLServer • • Jun 02 '19

Question Start my first job as a SQL Server DBA next week, any tips?

26 Upvotes

I have had many jobs in my young life but this is the first job since I graduated from college and is essentially my first real job. I am a little nervous about my first day, I really want to be able to impress them. They are a small company and I know they are super nice and excited to help me, but I want them to see me from day one and know I can handle whatever they send my way.

Still, I am very nervous about my first day.

Any tips?

Edit: Thank you to everyone for all the congratulations and advice! I feel a lot less nervous about my first day and I am ready to go in, ask questions, google everything, and just learn everything that I can.


r/SQLServer • • Apr 24 '19

SSMS 18.0 GA available "Dark" theme gone (or is it)

26 Upvotes

With SSMS 18.0 is no longer in preview and the first general availability (GA) version of SSMS 18.0 available, I was disappointed to see the Dark Theme once again removed. Luckily they've been kind enough to leave the option in the "ssms.pkgundef" file. Just as easy as commenting out the entry.

// Remove Dark theme
//[$RootKey$\Themes\{1ded0138-47ce-435e-84ef-9ec1f439b749}]

r/SQLServer • • Nov 23 '18

Please help me understand indexing

26 Upvotes

Hi all,

I'm now in the stage of my career at work where I really need to understand indexing in SQL Server at a more advanced level. (I.e up to the point where I can identify which indexes need to be built or modifed etc without SQL telling me to do so in an execution plan in green text).

My main experience so far has just been rebuilding fragmented indexes through the Ola or Brent ozar free scripts/jobs.

I've done my research before approaching this sub, but still have some questions and am hoping to get some clear guidance here.

I constantly am seeing explanations of indexes online being like a tree with leaves, etc, this is not helping me understand the concept conceptually or clearly. Everyone learns differently.

Here's what I really want to ask. Can I think of index objects (clustered or not) as equivalent to a STORED version of query results against the table that can be referenced by the SQL Query engine?

I know that may sound super confusing, so let me give an example.

Let's say I have a table (dbo.tblCities) -- with (StateID, CityName, StateName) representing all US Cities in each respective state. (example, Texas has over 9,000 cities alone).

A primary key could be on ID, and it could be the unique field in my theoretical example. (i.e this would number 1 to 50).

So let's start off with the Indexing.

I know enough that StateID would be the primary key/clustered index in this example, as I stated above.

Where my confusion mainly comes from is two-fold:

  1. What's an example benefit of having StateID defined as the Clustered index aside from enforcing uniqueness? I.e. if I only had CityName and StateName columns, would a PK/Clustered Index on StateName be equally as beneficial as far as performance goes? What I'm trying to get at here is, if it wasn't about enforcing uniqueness in the table, wouldn't a non-clustered index on StateName asc have the same performance as StateID (clustered) in asc order?

  2. Non-clustered indexes. This is one of my main confusions. So we have one PK/Clustered index ordering the table by StateID in above example, so the physical order is 1 to 50 of that row, and thus of that table. If I did a non-clustered index on CityName by Ascending order (And for fun, we'll "include" StateName in the non-clustered index), can I think of this non-clustered index as an EQUIVALENT object associated with tblCities to the following query?

select CityName, StateName from tblCities order by CityName asc

Sorry if I'm way off the mark here, but I hope I'm somewhat understanding the ideas...

Thank you all in advance!!

EDIT 1: I wrote the question a little too quickly. Didn't realize I can't make StateID a PK since it wouldn't allow duplicates (Like the 9,000 cities in Texas). Thanks for pointing that out in the comments. I'm going through the replies.


r/SQLServer • • Apr 16 '18

How much do you hate querying XML with Transact-SQL?

26 Upvotes

Hi Reddit,

A little self-promotion here but I think you're going to like it! We just added an online-tool to our website that enables you to auto-generate Transact-SQL SQLXML code directly from a sample of your XML data.

This is especially useful for when you deal with a complex XML that you need to query containing nested namespaces (including defaults), or otherwise very "verbose" XMLs.

Give it a try and let us know if you can break it with your nastiest most hideous XML :)

Feedback (both positive and negative) is always welcome! :)

Here is the link: http://sqlhttp.net/online-tools/xqueryhelper/


r/SQLServer • • Dec 27 '17

Kendra Little has some great online training videos free for a short time, worth a look.

26 Upvotes

The check out system is a little clunky and it's a bit hard to navigate at first, but her videos are top notch. I'd recommend to see if there are any topics you want to watch before they go paid. There's a few I'm interested in for studying for the 70-762, so I figured if anyone else is studying for anything or just wants to learn, it's a good temporary resource.

https://sqlworkbooks.com/


r/SQLServer • • Oct 01 '15

SQL Server 2016 is x64 only

Thumbnail
blogs.technet.com
26 Upvotes

r/SQLServer • • Aug 01 '13

Understanding how SQL Server executes a query

Thumbnail
rusanu.com
26 Upvotes

r/SQLServer • • Jun 11 '13

Very Old Ashton-Tate/Microsoft SQL Server Commercial

Thumbnail
youtube.com
26 Upvotes

r/SQLServer • • Sep 10 '26

Community Share Microsoft ODBC Driver 18.7.1 for Microsoft SQL is now available

25 Upvotes

We released ODBC Driver 18.7.1 for Microsoft SQL.

The headline additions are:

  • float16 vector support

  • Load-balanced routing for Azure SQL Database Hyperscale named-replica reader endpoints

  • MultipleActiveResultSets, FailoverPartner, WorkstationID, and ConnectTimeout as accepted connection-string keywords

  • No separate Microsoft Visual C++ Runtime prerequisite on Windows

  • Support for Alpine Linux 3.23, SUSE Linux Enterprise Server 16, and Ubuntu 26.04

The connection-string work is in response to a ton of feedback we've gotten. ODBC historically used names such as MARS_Connection and WSID, while other Microsoft SQL drivers used different names for the same settings. The old names still work, but common configuration can now travel between drivers with fewer translations.

There is also a fair amount of lower-level reliability work in this release, including more defensive TDS protocol parsing, native memory fixes, improved cleanup when MARS connections terminate abruptly, and fixes in asynchronous timeout, OpenSSL, and XA transaction paths.

The full blog post is available here:

https://techcommunity.microsoft.com/blog/sqlserver/microsoft-odbc-driver-18-7-1-smaller-vectors-easier-configuration-and-better-clo/4555474


r/SQLServer • • Jun 25 '26

Community Share Microsoft.Data.SqlClient 7.0.2 and 6.1.6 are out!

25 Upvotes

We just shipped Microsoft.Data.SqlClient 7.0.2 and 6.1.6 with WAM broker support, TDS parsing hardening, and some key bug fixes.

Highlights across both releases:

  • Added WAM broker support for supported Entra ID authentication modes on Windows

  • Hardened TDS parsing with token data-length bounds checks

  • Fixed a SqlDataReader null-reference path in buffer-based reads

  • Fixed Always Encrypted column master key signature verification cache behavior

Install/update:

dotnet add package Microsoft.Data.SqlClient --version 7.0.2

dotnet add package Microsoft.Data.SqlClient --version 6.1.6

Release notes:

Announcement blog:

Repo: dotnet/SqlClient

We love your feedback! Feel free to comment below or on the repo.