SQL Server – Enable SQL Server 2012 AlwaysOn Availability Groups

In the previous post  SQL Server – AlwaysOn Availability Groups, described enhancement to SQL Server 2014 AlwaysOn Availability Groups. In this post, we will see how to enable SQL Server 2012 AlwaysOn Availability Groups using UI and PowerShell.

Using UI

  • Go to SQL Server Configuration Manager >> Navigate to SQL Server Service >> Right Click to SQL Server Service and Click to Properties
SQL Server - Enable SQL Server 2012 AlwaysOn Availability Groups

SQL Server – Enable SQL Server 2012 AlwaysOn Availability Groups

  • Navigate to AlwaysOn High Availability tab >> Check the “Enable AlwaysOn Availability Groups ” check Box
SQL Server - Enable SQL Server 2012 AlwaysOn Availability Groups

SQL Server – Enable SQL Server 2012 AlwaysOn Availability Groups

Using PowerShell

By using Enable-SqlAlwaysOn and Disable –SqlAlwaysOn PowerShellcommand, we can enable or disable the AlwaysOn Availability Groups feature.

PS C:\> Enable-SqlAlwaysOn -ServerInstance INSTANCENAME –Force

PS C:\> Disable-SqlAlwaysOn -ServerInstance INSTANCENAME -Force

The benefit of using this PowerShell is if we have two or more than two Windows Failover Cluster. Using the PowerShell minimizes the effort of logging in to each of the cluster nodes, opening SQL Server Configuration Manager to enable AlwaysOn Availability Groups.

Get-Cluster >> Get information about one or more failover clusters in a given domain
Get-ClusterNode >> Get information about one or more nodes (servers) in a failover cluster

But with the help forereach command; we can enable the AlwaysOn Availability Groups to all the available nodes.

PS C:\> foreach ($node in Get-ClusterNode) {Enable-SqlAlwaysOn -ServerInstance $node -Force}

Example :

SQL Server - Enable SQL Server 2012 AlwaysOn Availability GroupsSQL Server - Enable SQL Server 2012 AlwaysOn Availability Groups

SQL Server – Enable SQL Server 2012 AlwaysOn Availability Groups

You are done !!!