By: Manvendra Singh | Last Updated: 2018-11-22 | Comments (1) | Professional Development Interview Questions DBA
If you are looking to advance your career as a SQL Server DBA then you should be prepared for your next interview on the most used features in the product. SQL Server AlwaysOn is one of those features that most interviewers will evaluate your expertise. Keep reading this article to learn about SQL Server AlwaysOn interview questions and answers.
SQL Server AlwaysOn is an advanced feature introduced in SQL Server 2012 to support High Availability (HA) and Disaster Recovery (DR) solutions. Have a look at the set of AlwaysOn questions and answers for your next job interview.
What is SQL Server AlwaysOn?
Answer –AlwaysOn is a term Microsoft has used since SQL Server 2012 for high availability and disaster recovery solutions. As of now, two features fall under the umbrella of AlwaysOn. These two features support high availability and disaster recovery for SQL Server databases:
- SQL Server AlwaysOn Failover Cluster Instances (FCIs)
- SQL Server AlwaysOn Availability Groups (AGs)
SQL Server AlwaysOn FCIs are SQL Server clustered instances whereas AGs are the new features introduced in SQL Server 2012 to support data high availability and disaster recovery. We can group each set of databases into one unit and execute a failover at one time with the help of the Availability Group.
What is the difference between AlwaysOn Failover Cluster Instances and AlwaysOn Availability Groups (AOAG)?
Answer – Please have a look at the main differences between both AlwaysOn solutions:
- AlwaysOn Failover Cluster Instance needs shared storage between all of the nodes in the cluster. Whereas AlwaysOn Availability Groups do not require shared disk storage for the server hosting the SQL Server.
- AlwaysOn Failover Cluster Instance is available on both SQL Server Standard and Enterprise Edition whereas we need Enterprise Edition to configure SQL Server AlwaysOn Availability Groups until SQL Server 2014. There is now an option to create a basic Availability Group with SQL Server 2016 Standard edition, but it has lot of limitations.
- SQL Server AlwaysOn Failover Clustered Instances work at an instance level whereas Availability Group works at a database level or for a set of databases.
- We cannot use AlwaysOn Failover Clustered Instances while installing standalone instances whereas Availability Groups can be configured on both standalone as well as SQL Server Clustered Instances.
Can you explain Availability Group Listeners?
Answer - The Availability Group Listener is a virtual network name that we use to make connections to the databases whether it is running from a primary replica or secondary replica after failover.
Can we configure Availability Groups without configuring Availability Group Listeners?
Answer- Yes, we can configure an Availability Group without configuring listeners. Listeners are configured to make databases connections irrespective of their replica status.
When I tried to create a new Availability Group in SQL Server Management Studio, I saw that "New Availability Group Wizard" is grayed out and I am not able to proceed further to configure Availability Group. What could be the reason for this?Answer – The "New Availability Group Wizard" option is disabled until you enable the Availability Group feature from the SQL Server service property.
- You need to launch SQL Server Configuration Manager then open SQL Server service property.
- Here you can see the AlwaysOn High Availability tab. Click on this tab.
- You can see the Windows cluster name here if you have enabled the cluster feature. As we know Windows cluster is mandatory for AlwaysOn. If you haven’t configured a Windows cluster then first you need to configure it in order to enable AlwaysOn High Availability.
- Once you will enable it, the Cluster Group name will appear in this property window and the grayed-out option "Enable AlwaysOn Availability Group" will be enabled. Just click on this option and click the OK button.
- You need to restart the service to apply this change on the SQL Server Instance.
How do you configure an AlwaysOn Availability Group with a multi subnet network?
Answer – There is only one difference between configuring AOAG in a single vs. multi subnet. You will follow same process that we follow while configuring AOAG in a single subnet, but if you have a multi subnet network then we need one IP from each subnet to configure the AOAG listener. Read attached article where I have explained the step by step process to configure AOAG in a multi subnet network.
Can we add a new database to an existing Availability Group?
Answer – We can easily add new databases to an existing Availability Group. First, we need to prepare the secondary database by taking the full backup and subsequent transaction log backup then restore it on the secondary replicas in no recovery mode. Then we can right click on Availability Group name to launch the Add Database wizard. We should follow all required steps to proceed with this wizard. Once completed, your new database will be added to the identified Availability Group. You can read this whole process in detail in this article: How to Add New Database to Existing Availability Group?
Suppose you have 5 databases in an Availability Group. One database becomes inaccessible. Will the Availability Group initiate an automatic failover?
Answer – Until SQL Server 2014, the AlwaysOn Availability Group will not initiate a failover process if anything goes wrong at the database level. Microsoft introduced an option named Enhanced Database Failover in SQL Server 2016 to trigger the failover in case any database participating in an Availability Group loses the ability to write transactions. We also call it Database Level Health Detection in an Availability Group. By default, this option is not enabled. You need to configure it if you want to initiate a failover if anything goes wrong at the database level.
Can we add additional database files to a database that is part of an AlwaysOn Availability Group?
Answer – Yes, we can add database files to the databases that are configured as a portion of the AlwaysOn Availability Group.
Here are the high-level steps:
- First remove the database from the secondary replica. Now, the secondary database will be in a restoring state.
- Add the data file to your Availability database on the primary replica.
- Issue a transaction log backup of this availability database on the primary replica.
- Copy this transaction log backup to the secondary replica and restore it on its corresponding secondary replica using NORECOVERY and the WITH MOVE option.
- Now add the database back to AlwaysOn Availability Group.
Can we configure an Availability Group between SQL Server instances that are hosted on servers that are part of two different Windows server failover cluster groups?
Answer – No, we cannot configure AlwaysOn Availability Group between different Windows server failover cluster groups. All replicas must be part of same Windows server failover group. This is a basic prerequisite for AOAG.
- Keep an eye on next article SQL Server AlwaysOn Interview Questions & Answer- Part 2.
- Read more articles on SQL Server AlwaysOn in attached article.
- You can also read more article on SQL Server DBA Interview Questions.
- Explore more knowledge on SQL Server Database Administration Tips.
Last Updated: 2018-11-22
About the author
View all my tips