Steps to configure Always on availability groups in SQL Server 2012
1. Always on availability groups can be configured in standalone or clustered SQL Server instance.
2. All SQL Server instance (principal and all replicas) must reside on servers which are part of same Windows Server Failover Cluster.
3. The server instance must be running an edition of SQL Server that supports AlwaysOn Availability Groups
To install and configure windows failover cluster follow the steps in HOW TO CREATE CLUSTER USING HYPER-V
Ensure all the systems which has SQL Server instances and will host principal and all replica databases are part of same windows cluster.
Note: Windows failover cluster can be installed and configured without shared disk starting from windows2008 unlike windows2003.
Once the cluster is configured follow the below step by step guide to setup always on
In SQL Server Configuration Manager, click SQL Server Services, right-click SQL Server for which you want to enable AlwaysOn Availability Groups, and click Properties.
Select the AlwaysOn High Availability tab.
Verify that Windows failover cluster name field contains the name of the failover cluster. If this field is blank, this server instance currently does not support AlwaysOn Availability Groups. Either the local computer is not a cluster node, the Windows Server Failover cluster has been shut down, or this edition of SQL Server 2012 that does not support AlwaysOn Availability Groups.
Select the Enable AlwaysOn Availability Groups check box, and click OK.
Open SQL Server Management Studio.
Choose any one instance to become PRIMARY. Expand Alwayson High availability->Right-click Availability Groups and select New Availability Group wizard.
New Availability group introduction window will appear,Click Next.
Specify availability group name and click Next.
Select the user databases for the availability group(Database Should have Full backup) and click Next.
Specify an instance of SQL Server to host a secondary replica by selecting Add replica.
Add NODE2 as secondary replica by connecting it.
After selecting secondary replica,Optionally, you can specify endpoint details or leave them default.
Set the backup preference.
Specify your preference for an availability group listener that will provide a client connection point or else select do not create an availability group listener now.
Select your data synchronization preference as Full and specify a shared network location accessible by all replicas.
Summary of availability group validation will be displayed,Click Next.
Verify the choice made in this wizard.Click Finish.
Wizard completed successfully,Click close and finish the availability group wizard.
Successfully we have created a availability group called AGroup.
You can suspend and resume data movement by expanding Availability groups->Group name->Availability databases->Choose the database –>resume or suspend database.
You can view the synchronization status through the dashboard reports.
If you want to do a failover,right click the available group->group name->Failover.