SQL Centre of Excellence

If you are continually creating Always On availability groups you may want to speed up the enabling of the Always On service within SQL Configuration manager (see below). In my demo of a four node cluster creation from scratch, you “really” don’t want to manually log onto each node to reconfigure and restart the service!

image

Here is the PowerShell Script I use in a demo to enable multiple nodes at once

# ConfigureAlwasyOn.ps1
#
#   SUMMARY;
#       Enables AlwaysOn on instances See 
# http://msdn.microsoft.com/en-us/library/ff878259(v=sql.110).aspx
 
 
cd SQLSERVER:\SQL\NODE2\DEFAULT
Write-Host -ForegroundColor Green "Enabling AlwaysOn on NODE2"
Enable-SqlAlwaysOn -Force > $null
 
cd SQLSERVER:\SQL\NODE3\DEFAULT
Write-Host -ForegroundColor Green "Enabling AlwaysOn on NODE3"
Enable-SqlAlwaysOn -Force > $null
 
cd SQLSERVER:\SQL\NODE4\DEFAULT
Write-Host -ForegroundColor Green "Enabling AlwaysOn on NODE4"
Enable-SqlAlwaysOn -Force > $null

 

Notice that between RC0 and RTM of SQL 2012 the name of the cmdlet has changed from “-HaDrService” to “-SqlAlwaysOn”.The techies managed to catch up with the marketing people!

blog comments powered by Disqus

Page List

Page List