This topic introduces the steps for configuring instances of SQL Server 2012 to support AlwaysOn Availability Groups and for creating, managing, and monitoring an availability group.
Before You Begin:
Getting started with:
Configuring an instance of SQL Server to support AlwaysOn Availability Groups
Creating and configuring a new availability group
Managing availability groups, replicas, and databases
Monitoring availability groups
Before you create your first availability group, we recommend that you read the following topics:
Enable AlwaysOn Availability Groups. The AlwaysOn Availability Groups feature must be enabled on every instance of SQL Server 2012 that is to participate in an availability group.
Prerequisites: The host computer must be a Windows Server Failover Clustering (WSFC) node.
For information about the other prerequisites, see "SQL Server Instance Prerequisites and Restrictions" in Prerequisites, Restrictions, and Recommendations for AlwaysOn Availability Groups (SQL Server).
Create database mirroring endpoint (if none). Ensure that each server instance possesses a database mirroring endpoint. The server instance uses this endpoint to receive AlwaysOn Availability Groups connections from other server instances.
To determine whether database mirroring endpoint exists:
For Windows Authentication: To create a database mirroring endpoint, using:
For certificate authentication: To create a database mirroring endpoint, using:
Create the availability group. Create the availability group on the instance of SQL Server that hosts the databases to be added to the availability group.
Minimally, create the initial primary replica on the instance of SQL Server where you create the availability group. You can specify from one to four secondary replicas. For information about availability group and replica properties, see CREATE AVAILABILITY GROUP (Transact-SQL).
We strongly recommend that you create an availability group listener.
Prerequisites: The instances of SQL Server that host availability replicas for a given availability group must reside on separate nodes of a single WSFC cluster. The only exception is that while being migrated to another WSFC cluster, an availability group can temporarily straddle two clusters.
For information about the other prerequisites, see "Availability Group Prerequisites and Restrictions", "Availability Database Prerequisites and Restrictions", and "SQL Server Instance Prerequisites and Restrictions" in Prerequisites, Restrictions, and Recommendations for AlwaysOn Availability Groups (SQL Server).
To create an availability group you can use any of the following tools:
Join secondary replicas to the availability group. Connect to each instance of SQL Server 2012 that is hosting a secondary replica, and join the local secondary replica to the availability group.
Prepare secondary databases. On every server instance that is hosting a secondary replica, restore backups of the primary databases using RESTORE WITH NORECOVERY.
Join secondary databases to the availability group. On every server instance that is hosting a secondary replica, join each local secondary database to the availability group. On joining the availability group, a given secondary database initiates data synchronization with the corresponding primary database.
Create an availability group listener. This step is necessary unless you already created the availability group listener while creating the availability group.
Give the listener's DNS host name to application developers. Developers needs to specify this DNS name in the connection strings to direct connection requests to the availability group listener. For more information, see Availability Group Listeners, Client Connectivity, and Application Failover (SQL Server).
"Follow Up: After Creating an Availability Group Listener" in Create or Configure an Availability Group Listener (SQL Server)
Configure Where Backup Jobs. If you want to perform backups on secondary databases, you must create a backup job script that takes the automated backup preference into account. Create a script for each database in the availability group on every server instance that hosts an availability replica for the availability group.
"Follow Up: After Configuring Backup on Secondary Replicas" in Configure Backup on Availability Replicas (SQL Server)
For information about availability group and replica properties, see CREATE AVAILABILITY GROUP (Transact-SQL).
Managing existing availability groups involves one or more of the following tasks:
Modify the flexible failover policy of the availability group to control the conditions that cause an automatic failover. This policy is relevant only when automatic failover is possible.
Perform a planned manual failover or a forced manual failover (with possible data loss), typically called forced failover. For more information, see Failover and Failover Modes (AlwaysOn Availability Groups).
Use a set of predefined policies to view the health of an availability group and its replicas and databases.
Add or remove a secondary replica.
Suspend or resume an availability database. Suspending a secondary database keeps at its current point in time until you resume it.
Add or remove a database.
Reconfigure or create an availability group listener.
Delete an availability group.
Troubleshoot add file operations. This might be required if the primary database and a secondary database have different file paths.
Alter availability replica properties.
To monitor the properties and state of an AlwaysOn availability group you can use the following tools.
System Center Monitoring pack for SQL Server
The Monitoring pack for SQL Server (SQLMP) is the recommended solution for monitoring availability groups, availability replica and availability databases for IT administrators. Monitoring features that are particularly relevance to AlwaysOn Availability Groups include the following:
To download the monitoring pack (SQLServerMP.msi) and SQL Server Management Pack Guide for System Center Operations Manager (SQLServerMPGuide.doc), see:
AlwaysOn Availability Groups catalog and dynamic management views provide a wealth of information about your availability groups and their replicas, databases, listeners, and WSFC cluster environment.
SQL Server Management Studio
The Object Explorer Details pane displays basic information about the availability groups hosted on the instance of SQL Server to which you are connected.
SQL Server Management Studio
Properties dialog boxes enable you to view the properties of availability groups, replicas, or listeners and, in some cases, to change their values.
The SQLServer:Availability Replica performance object contains performance counters that report information about availability replicas.
The SQLServer:Database Replica performance object contains performance counters that report information about the secondary databases on a given secondary replica.
The SQLServer:Databases object in SQL Server contains performance counters that monitor transaction log activities, among other things. The following counters are particularly relevant for monitoring transaction-log activity on availability databases: Log Flush Write Time (ms), Log Flushes/sec, Log Pool Cache Misses/sec, Log Pool Disk Reads/sec, and Log Pool Requests/sec.
Video—Introduction to AlwaysOn: Microsoft SQL Server Code-Named "Denali" AlwaysOn Series,Part 1: Introducing the Next Generation High Availability Solution