Professional Documents
Culture Documents
AlwaysOnAvailabilityGroupsCreation
Search...
TechCoffee
techabreak,haveacoffee:)
CLOUD
SECURITY
STORAGE
SQL SERVER
SYSTEM CENTER
WINDOWS SERVER
VIDEO CHANNEL
CONTACT
Home/SQLServer/AlwaysOnAvailabilityGroupsCreation
SOCIAL
SQLServer2012/2014AlwaysOnAvailabilityGroups:
ArticleSummary
Part1AlwaysOnIntroduction
Part2AlwaysOnDesign
WHITEPAPER
ImplementahighlyavailablePrivateCloudtohost
virtualmachines
Part3InstallandConfigureWindowsServer2012R2inCoremode
Part4WSFCClusterCreation
Part5InstallSQLCoreonWindowsCoreServer
Part6AlwaysOnAvailabilityGroupsCreation
Part7AlwaysOnAvailabilityGroupsCreation(Advanced,withdedicatedReplicationNetwork)
Part8MethodstoaddDatabaseonAvailabilityGroups(SCOMExample)
Part9AlwaysOnAvailabilityGroupsPowerShellMonitoring
ANNEX(Part6/7)ManageSQLEndpoint
UnderstandMicrosoftHyperConvergedSolution
NowthenextstepistocreateandconfigurethefirstAvailabilityGroups.
Therearethreemethodstodothis:
with Wizard through Management Studio
with PowerShell
with TransactSQL
IwillusetheWizardtocreatethefirsttwogroups(thispermittocreatealsotheTransactSQLscriptsthat
wecanreuselater).
Popular
Recent
Comments
SoftwareUpdatewithSCCMPART3Automatic
DeploymentRules
March8,2014
SCCMSoftwareUpdatePART1Introductionto
SCCMandWSUS
March7,2014
PrepareaDatabase
http://www.techcoffee.net/alwaysonavailabilitygroupscreation/
1/11
2/14/2016
AlwaysOnAvailabilityGroupsCreation
PrepareaDatabase
PrepareaVMTemplateforfast
deploymentinVMM2012R2
Forreminder,thefirstavailabilitygroupwillbenamedAAG1andreplicawillbehostoninstance:
MSQLA1\AOI1
MSQLA3\AOI3
June8,2014
SCCMSoftwareUpdatePART2SoftwareUpdate
Pointconfiguration
March7,2014
FortestIusetheMicrosoftAdventureWorksDatabasesample.DownloadAdventureWorks2012DataFile
(around200Mb)from:http://msftdbprodsamples.codeplex.com/releases/view/55330
CopyDatabasefileto:G:\MSSQL\AOREPLICA\MSSQL\Data.
IrenameittoAdvWorks1(IwillusesamemdfforothertestsDB)
SCCMSoftwareUpdatePART4Create
deploymentpackagesmanually
March9,2014
CATEGORIES
Backup
Cloud
AzureStack
MicrosoftAzure
WindowsAzurePack
Security
Adddatabasetofirstinstance(MSQLA1\AOI1):
ThereisonlyMDFfile.Soinordertobuildanewlogfile,usetheATTACH_REBUILD_LOGoptionwhen
attachingthedatabases.
SQLServer
Storage
QNAP
SoftwareDefinedStorage
Synology
USE [master]
GO
CREATE DATABASE [AdvWorks1]
ON (FILENAME = N'G:\MSSQL\AOREPLICA\Data\AdvWorks1.mdf')
SystemCenter
ConfigurationManager
DataProtectionManager
VirtualMachineManager
FOR ATTACH_REBUILD_LOG
TechEd14
GO
WindowsServer
HyperV
SELECT
DB_NAME(database_id) AS "Database Name",
type_desc AS "File Type",
name AS "Logical File Name",
physical_name AS "Physical File",
state_desc AS "State"
FROM sys.master_files WHERE database_id IN (DB_ID('AdvWorks1'));
ARCHIVES
Archives
SelectMonth
CheckBackupmodeofDB:
Anotherprerequisiteisthatyouhavetodoatleast1fullbackupofeachdatabasethatwillbepartofyour
AG:
http://www.techcoffee.net/alwaysonavailabilitygroupscreation/
2/11
2/14/2016
AlwaysOnAvailabilityGroupsCreation
OrfromSQL:
SonowDatabaseisreadywithafullbackup.
MirroringEndpointsNote
ThefirststepistocreateoneMirroringEndpointperInstance.
Forreminder,IhavepreparedadedicatenetworkforSQLInstancesCommunications:VLANReplication.
FortestsIwillconfiguretwoinstancesAOI2andAOI4tousethisNetworkandthetwoothertothe
defaultnetwork(Public):
Hostname
IPVLANPublic
IPVLANCLUSTER
IPVLANReplication
MSQLA1
10.0.1.21
10.0.10.21
n/a
MSQLA2
10.0.1.22
10.0.10.22
10.0.20.22
MSQLA3
10.0.1.23
10.0.10.23
n/a
MSQLA4
10.0.1.24
10.0.10.24
10.0.20.24
Explications:
BydefaulttheWizardcreateautomaticallyaMirroringEndpointforeachInstance(TheEndpoint
configurationdoesntcontainsanyNetworkparameter)andconfiguretheReplicaEndpointURLwiththe
serverFQDN.Example:TCP://MSQLA1.lab1.ad:5022.
WiththisconfigurationtheInstancecommunicationwillbedoneoverthePublicNetwork
ThispartwillbedonefortheAAG1andtheAAG2(InstanceAOI1andAOI3).
ToconfigureinstanceforcommunicateovertheReplicationNetwork,wehavetocreatetheEndpointand
specifyanIPaddressofthereplicationnetworkforeachinstanceandconfiguretheEndpointURLwiththis
IPforeachReplica.
ThispartwillbedonefortheAAG3andtheAAG4(InstanceAOI2andAOI4).
Forreminder,thereisonlyoneEndpointperInstance(canbeusedformultipleAvailabilityGroup).
CreateAAG1(InstanceAOI1&AOI3)
Ok,nowIcreatethefirstAAG(DBTest01istheAdvWorks1databaseaddedbefore)
http://www.techcoffee.net/alwaysonavailabilitygroupscreation/
3/11
2/14/2016
AlwaysOnAvailabilityGroupsCreation
Schema:AlwaysOnAvailabilityGroupsAAG1
FromMSQLA1,startManagementStudio,connecttoinstanceAOI1.
RightclickonAvailabilityGroupandselectNewAvailabilityGroupWizard:
SpecifytheAAGname(thiswillbetheWSFCResourceGroupname):
SelecttheDB:
SelectAddreplica
http://www.techcoffee.net/alwaysonavailabilitygroupscreation/
4/11
2/14/2016
AlwaysOnAvailabilityGroupsCreation
ConnecttotheAOI3instance:
EnableAutomaticFailover(SynchronousCommitmustbeenabled)andconfiguretheReadableSecondary
Option(FormoreinformationaboutparametersseechapterAvailabilityReplicasConfigurationin
Part2AlwaysOnLabDesign)
ConfigureEndpoints(DefaultURL=ServerFQDN=>CommunicationonthePublicnetwork):
ConfigureBackupPreferences(thisisthedefaultoption):
http://www.techcoffee.net/alwaysonavailabilitygroupscreation/
5/11
2/14/2016
AlwaysOnAvailabilityGroupsCreation
CreatetheListener:
(WhenyouconfigurelaterapplicationstohosttheirDatabasesintheAAGyouhavetospecifythisListener
DNSNameandthePort,thisistheonlyinformationknownbyapplications).
Note:TheListenerVCOandDNSrecordmustbeprestage(seechapterPrestageAvailabilityGroup
ListenerinarticlePart6CreateAAG)
SelectFullfortheinitialdatasynchronizatrion:
Note:IfthedefaultDatabasepaths(fileandlog)arenotthesameonallinstances,theFullmodewillnot
work.
FormoreinformationseeparagraphNoteforDatabases/LogspathonAAGinthechapterStorage
onPart2AlwaysOnLabDesign
MoreinformationonDataSynchronizationPage:
SelectInitialDataSynchronizationPage(AlwaysOnAvailabilityGroupWizards)
http://msdn.microsoft.com/enus/library/hh231021.aspx
ManuallyPrepareaSecondaryDatabaseforanAvailabilityGroup(SQLServer)
http://msdn.microsoft.com/enus/library/ff878349.aspx
http://www.techcoffee.net/alwaysonavailabilitygroupscreation/
6/11
2/14/2016
AlwaysOnAvailabilityGroupsCreation
ClickonScriptandsaveitandstartthecreation:
CheckAAG
NowyoucanstarttheDashboardtochecktheStatusofAAG:
Note:RequiresPermissionstouseDashboard:
CONNECT
VIEWSERVERSTATE
VIEWANYDEFINITION
http://www.techcoffee.net/alwaysonavailabilitygroupscreation/
7/11
2/14/2016
AlwaysOnAvailabilityGroupsCreation
AndviatheWSFCConsole,youcanshowtheavailabilitygroupresourcegroupstatus:
Note:NormallyyoushouldnotusetheWSFCConsoletoadministerAlwaysOnAvailabilityGroups.
Everything(failover)mustbedoneviatheDashboard,TransactSQLorPowerShell.TheWSFCConsole
providesaviewoftheclusterstate.
CreateAAG2(InstanceAOI1&AOI3)
SonowIwillcreatethesecondAvailabilityGroup(onthesamenodeasAAG1).
Attheend,therewillbeanactivedatabaseoneachinstancewithareplicaoneachotherside.Sotheloss
ofaninstancewillbesupported.
Schema:AlwaysOnAvailabilityGroupsAAG2
FromInstanceMSQLA3\AOI3
CreateatestDBwithonetable:
http://www.techcoffee.net/alwaysonavailabilitygroupscreation/
8/11
2/14/2016
AlwaysOnAvailabilityGroupsCreation
MAXSIZE = 500MB,
FILEGROWTH = 1MB )
LOG ON
( NAME = DBTestAOI3_Log,
FILENAME = 'L:\MSSQL\AOREPLICA\Log\DBTestAOI3_log.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB ) ;
GO
USE DBTestAOI3
GO
CREATE TABLE Servers (SrvID int IDENTITY (100,1) PRIMARY KEY, Name nvarchar (50))
GO
-- Populate Table
INSERT INTO Servers ([Name]) VALUES ('ServerAOI3-01')
INSERT INTO Servers ([Name]) VALUES ('ServerAOI3-02')
INSERT INTO Servers ([Name]) VALUES ('ServerAOI3-03')
GO
select * from servers
Doafullbackup:
CreatetheAAG2
EnterAAGname:
Selectthedatabase:
AddthereplicaMSQLA1\AOI1
http://www.techcoffee.net/alwaysonavailabilitygroupscreation/
9/11
2/14/2016
AlwaysOnAvailabilityGroupsCreation
NotethatyoucannotchangethenameorportofEndpoints(therewaspreviouslycreatedwiththefirst
AAG):
ConfigureBackupPreferences:
ConfiguretheListener:
SelectInitialsynchronizationoption:
StarttheAvailabilityGroupcreation:
Sonow,thetwoAAGarecreated:
NetworkNote:
WecanseethattheInstancescommunicationsareestablishedonthePublicNetwork(10.0.1.0),thisisdue
totheendpointsconfiguration:
ShareNote:
ThenetworksharespecifyintheInitialsynchronizationpagecontainsbackupofDatabasesaddedtothe
AG.Thesebackupscanberemoved,thereareusedonlyfortheinitialreplicacreation.
tweet
Taggedwith:
Share
ALWAYSON
AVAILABILITYGROUP
SQLSERVER2012/2014
http://www.techcoffee.net/alwaysonavailabilitygroupscreation/
10/11
2/14/2016
AlwaysOnAvailabilityGroupsCreation
Previous:
Next:
VMnetworkissueinVMM2012R2with
IPAMintegration
IPPoolinVirtualMachineManager
2012R2
RELATED POSTS
WindowsAzurePackSQL
ServerinAlwaysOnasa
Service
Whitepaper:Implementa
highlyavailableprivatecloud
tohostvirtualmachines
January13,2015
December25,2014
AlwaysOnAvailabilityGroup
Introduction
April27,2014
LEAVE A REPLY
Enteryourcommenthere...
TAGS
RECENT POSTS
[Whitepaper]UnderstandMicrosoftHyperConvergedsolution
February8,2016
IssuewhendeployAzureStackTechnicalPreview1onlyonSSD
February5,2016
Createanoffer,aplanandgetasubscriptioninAzureStackTechnicalPreview
1
February1,2016
SCCM2012R2 Security
ServiceProviderFoundation
DeployAzureStackTechnicalPreview1
January30,2016
Softwaredefinedstorage SoftwareUpdatePoint
SQLServer Storage StorageSpacesDirect
StorageQualityofServiceinWindowsServer2016
January25,2016
http://www.techcoffee.net/alwaysonavailabilitygroupscreation/
11/11