Enabling AlwaysOn in SQL Server
In this recipe, we will enable the AlwaysOn feature in SQL Server.
Getting ready
Check whether the AlwaysOn feature is enabled. You can do this from the GUI by launching SQL Server Configuration Manager, right-clicking on the SQL Server database engine service, and selecting Properties. Click on the AlwaysOn High Availability tab:
You can also do this using PowerShell by running the following code:
$instanceName = "SQL01" $server = New-Object Microsoft.SqlServer.Management.Smo.Server -ArgumentList $instanceName #check AlwaysOn $server.IsHadrEnabled
To check this feature against multiple nodes, you can use the following code snippet:
$nodeNames = Get-ClusterNode | Select-Object –ExpandProperty Name Foreach-Object ($instanceName in $nodeNames) { $server = New-Object Microsoft.SqlServer.Management.Smo.Server -ArgumentList $instanceName #check AlwaysOn $server.IsHadrEnabled }
How to do it...
Perform the following steps to enable...