SQL Server 2012 AlwaysOn on Windows 2012

SQL Server 2012 AlwaysOn on Windows 2012
Introduction:
Always On Availability Groups is one of the big new feature in the High Availability stack of SQL Server 2012 basically it is the
successor of Database Mirroring and offers you the advantages over traditional Database Mirroring.
1.
2.
3.
4.
5.
6.
7.
8.
WSFC to perform failovers.
Shared storage not required.
Utilizing database mirroring for the data transfer over TCP/IP.
Providing a combination of Synchronous and Asynchronous mirroring.
Providing a logical grouping of similar databases via Availability Groups.
Creating up to four readable secondary replicas.
Allowing backups to be undertaken on a secondary replica
Performing DBCC statements against a secondary replica
Figure: A
Above figure is an example of AlwaysOn Availability group. The only requirement is the fact that each participating
SQL Server instance must be in the same Windows Domain, because you must create a Windows Server Failover
Cluster (WSFC) that contains all participating SQL Server Instances. SQL Server uses underneath several WSFC features
like the Quorum Model. Database Mirroring uses its own Quorum Model by using a dedicated Witness instance.
Follow the below steps to create SQL Server 2012 AlwaysOn Availability Group for your mission-critical databases.
Prerequisites
1.
2.
3.
4.
5.
1.
Windows Server Failover Cluster (WSFC).
Quorum configuration using file sharing (Optional).
SQL Server 2012 Enterprise Edition.
Collation settings have to same on both the Nodes.
Two to Five servers acting as a Replica.
Windows Server Failover Cluster (WSFC).
First you need to add the Windows Failover Custer Feature to all the machines running the SQL Server Instance that
you will configure as replicas.
To add the Failover Cluster Feature follow the below steps.
By Deepak Bhardwaj
A). Open the Server manager console and Select Add roles and Features as given below:
B). Click Next as given in the below screen.
C). Click Next as given in the below screen.
By Deepak Bhardwaj
D). Click Next as given in the below screen.
E). Click Next in the given below screenshot and then Click Install to install the Failover Clustering feature.
F). On both the nodes that are going to participate in the SQL Server AlwaysOn Cluster need to have .NET
Framework 3.5.1 or above and the Failover Clustering feature enabled.
By Deepak Bhardwaj
G). Click on Validate a Configuration link.
H). In the Select Servers or a Cluster dialog box, add the server hostnames of the SQL Server
Instances that you want to configure as replicas in your Availability Group. Click Next.
I). In the Testing Options dialog box, make sure that the option Run all tests (recommended) is
Selected. Click Next.
By Deepak Bhardwaj
J). Click on Next in the below Screenshot.
K). Click on Next as given in the below Screenshot.
L). Click Next as given in the below screenshot.
By Deepak Bhardwaj
M). In the Access Point for Administering the Cluster dialog box, enter the virtual server name
And Virtual IP address of your Windows Failover Cluster.
N). Once all process completed you will get the successful message of cluster configuration.
2. Quorum configuration using file sharing (Optional).
Note: Now configure the Quorum considering you do not have Storage. Follow the below steps.






To configure the cluster quorum configuration to use a file share, right-click on the cluster name,
select More Actions and click Configure Cluster Quorum Setting. You will be configuring a file
share witness for cluster quorum setting. By default, the wizard will configure the cluster to use
Node Majority.
o
Click Next.
In the Select Quorum Configuration page, Select Add or change the Quorum witness option.
Click Next
In the Select Quorum Witness page, Select the configure a file share witness (Recommended for
a special configuration) option.
Click Next.
By Deepak Bhardwaj



In the Configuration File Share Witness page, Type path of the file share which you want to use
in the File share Path text box.
Click Next
In the Configuration Page click next and then in Summary page click finish.
3. SQL Server 2012 Enterprise Edition Installation.
Above we have configured two nodes in WSFC. Make sure that you have Installation Media
which is available for download from Microsoft SQL Server 2012 Downloads.
Now we have to start the installation process On Node1. Click on setup.exe to begin the
installation process. Now you should navigate to the Installation Tab to start the installation,
selecting ‘New SQL Server stand-alone installation or add features to an existing installation’.
Then follow the below screen-shots.
Step1. The Setup Rules should all complete successfully and you can then click ‘OK’ to continue.
Once your Product Update scan has completed click ‘Next’.
Step2. Select ‘SQL Server Feature Installation’, click ‘Next’.
By Deepak Bhardwaj
Step3. Choose the features you need to install, click ‘Next’.
Step4. Enter your SQL Server 2012 Instance Name for the Instance that you are building or you
Can choose Default Instance, click ‘Next’
By Deepak Bhardwaj
Step5. Click Next.
Step6. You will need to have your Domain service accounts created and set the
passwords on this Server Configuration screen in the installation. Once you have set the
passwords, make sure you click on the Collation Tab so as to configure your Collation for
the Instance, click ‘Next’.
By Deepak Bhardwaj
Step7. On the Database Engine Configuration screen there are three tabs .The Server
Configuration Tab is where you set your security mode – Always recommend Windows
Authentication or you can select Mixed Mode or both. Remember to add the current
account you are running the installation as, as well as any other individuals or groups that
need to be members of the SysAdmins group.
Step8. Click Next.
By Deepak Bhardwaj
Step9. Click Next.
Step10. Ready to Install.
Note: Once installation completed successfully than follow the same steps on Node 2.
By Deepak Bhardwaj
5. AlwaysOn Configuration.
Now in the final step you have to enable AlwaysOn Availability Groups on each SQL Server instance. This
can be done through the SQL Server Configuration Manager and the tab AlwaysOn High Availability.
You have to enable the checkbox “Enable AlwaysOn Availability Groups“. This option is only available
when the computer where the SQL Server instance is running on, is part of a WSFC cluster.
Now restart he SQL services.
Once AlwaysOn Availability Groups enabled than follow the below steps to configure the database part
of AlwaysOn.
Step 1. Every replica needs to have access to a shared location to access the database backups created
and used for synchronizing the secondary databases. As given below create a share folder SQLAlwaysOn.
Make Sure SQl service account have read and Write access on the folder.
By Deepak Bhardwaj
Step 2. Open SQL Server Management Studio. Connect to the SQL Server instance than
right click on AlwaysOn High Availability Group and Click on New Availability Group Wizard.
Step 3. Click on Next.
By Deepak Bhardwaj
Step 4. Specify the Availability Group Name.
Step 5. In the Select Databases page, select the checkbox beside the database that you want to include
in your Availability Group. The databases have to be in Full recovery model prior to joining them in the
Availability group. Click Next.
By Deepak Bhardwaj
Step 6. In the Specify Replicas page, under the Replicas tab, click the Add Replicas button and connect to
the other SQL Server instances that you joined as nodes in your Windows Server Failover Cluster.
Configure the following options.
I.
II.
III.
Automatic Failover (Up to 2) :
Synchronous Commit (Up to 3) :
Readable Secondary:
Checked
Checked
No
Step 7. In the Endpoints tab, verify that the port number value is 5022.
Step 8. Selecting the Listener Tab, give your AGLTEST a name, port number and the appropriate IP
Addresses, click ‘Next’
By Deepak Bhardwaj
Step 9. Enter your share path which is created in Step 1 then click ‘Next’.
Step 10. Ensure that you receive all green ticks for your validation, click ‘Next’
Step 11. Review the summary, click ‘Finish’ than it will start full back and restoration process on
Secondary database on Full backup restoration process completed than next process start for
transaction log restoration and make database part of AGL.
By Deepak Bhardwaj
Enjoy configuring your new SQL Server 2012 AlwaysOn environment.
End of Document.
By Deepak Bhardwaj