Streamline SQL Server Management with Contained Availability Groups
SQL Server Availability Groups can present challenges after a failover, such as missing logins, outdated passwords, or absent SQL Server Agent jobs. Some clients address these issues by requiring the primary replica to remain on the same instance. If a failover occurs due to an outage or patching, they generally request to revert the AG back to the original primary replica, where all the scheduled jobs and logins are located. Microsoft introduced Contained Availability Groups with the release of SQL Server 2022 Enterprise Edition to help alleviate some of these problems.
What are contained Availability Groups?
Contained AGs enhance the traditional Availability Groups (AGs) introduced in SQL Server 2012. CAGs include user databases and the associated server objects, such as logins, permissions, and SQL Server Agent jobs. Contained AGs automatically sync these objects across replicas. This saves the DBA from having to manually make these changes.
Key benefits of contained AGs
Ease of Management: Contained AGs bundle both databases and associated instance-level objects, simplifying management. This especially simplifies managing complex environments in which an application depends on resources outside of the database replica. Before CAGs, the synchronization of these objects required home-grown solutions using T-SQL and/or PowerShell.
Seamless Failover: With traditional AGs, failover could sometimes result in missing instance-level objects, leading to broken applications. CAGs ensure that all necessary objects are included within the group, providing a seamless failover experience.
Getting started
To get started, you’ll need:
- A Windows Server Failover Cluster (preferably Windows Server 2022) with at least two nodes.
- SQL Server 2022 Enterprise Edition. Developer Edition works for testing purposes.
Additionally, the following resources can be used as a guide for building your contained AG:
- SQL Server Contained Availability Groups Configuration (mssqltips.com)
- What is a contained availability group? – SQL Server Always On | Microsoft Learn
Want to work with The SERO Group?
Learn how The SERO Group can simplify SQL Server management for your organization. Schedule a no-obligation discovery call with us to get started.