Home > AlwaysOn 2012 > Configure Always On and Availability group Part 1

Configure Always On and Availability group Part 1

Enable AlwaysOn and Configure Availability Group with Primary Replica

# Check Always On  is enabled

PS C:\> Set-Location SQLServer:\SQL\SQL03\GOSGPRDSQL02 PS SQLSERVER:\SQL\SQL03\GOSGPRDSQL02>Get-Item . |Select IsHADREnabled |Format-Table -AutoSize

image

# Enable always on if not enabled.

PS C:\> Enable-SqlAlwaysOn -Path SQLSERVER:\SQL\SQL03\GOSGPRDSQL03

image

#SQL Server services should be recycled  (Stopped and started)

image

#Check AlwaysOn is Enabled.

image

#Create Database Mirroring Endpoint @ Primary SQL Instance

image

 

#Create Database Mirroring Endpoint @ Secondary SQL Instance

image

 

#Create Availability Group  with Primary Instance as Replica (Secondary Replica will be added later)

T-SQL

USE [master] GO CREATE AVAILABILITY GROUP [GOSGPRDAGSQL02SQL03] WITH (AUTOMATED_BACKUP_PREFERENCE = SECONDARY) FOR REPLICA ON N'SQL03\GOSGPRDSQL02' WITH (ENDPOINT_URL = N'TCP://SQL03.dbprox.local:5022', FAILOVER_MODE = AUTOMATIC, AVAILABILITY_MODE = SYNCHRONOUS_COMMIT, SESSION_TIMEOUT = 10, BACKUP_PRIORITY = 50, PRIMARY_ROLE(ALLOW_CONNECTIONS = ALL), SECONDARY_ROLE(ALLOW_CONNECTIONS = NO)); GO

 

Powershell

$primaryReplica = New-SqlAvailabilityReplica -Name "SQL03\GOSGPRDSQL02" -EndpointURL "TCP://SQL03.dbprox.com:5022" -AvailabilityMode "SynchronousCommit" -FailoverMode "Automatic" -Version 12 -AsTemplate New-SqlAvailabilityGroup -Name "GLBAGSQL0203" -Path "SQLSERVER:\SQL\SQL03\GOSGPRDSQL02" -AvailabilityReplica @($primaryReplica)

 

image

 

image

 

#Availability Group service is create and can be seen in the Windows Cluster

 

image

Categories: AlwaysOn 2012
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: