solving sql server problems for millions of dbas and developers since 2006


Identify and resolve SQL Server problems BEFORE they happen with SQL diagnostic manager

SQL Server DBA Tips SQL Server Developer Tips SQL Server Business Intelligence Tips SQL Server Career Tips SQL Server Whitepapers SQL Server Tools SQL Server Webcasts SQL Server Questions and Answers SQL Server Questions and Answers









Fix SQL Server Agent on Windows Failover Cluster

By: | Read Comments (4) | Print

Edwin works as a SQL Server DBA for The Pythian Group in Ottawa and is a SQL Server MVP.

Related Tips: More

Problem

I was trying to install SQL Server 2008 R2 on a Windows Server 2008 R2 Failover Cluster, but the setup did not complete successfully. Upon further investigation, the issue seems to be caused by a DNS entry that was then fixed by the systems administrator. While the SQL Server cluster resource group was successfully brought online after the DNS issue was fixed, I noticed that the SQL Server Agent was not listed as a resource type under the Other Resources section of the cluster resource group. How do I manually add the SQL Server Agent to the cluster resource group?

failover cluster sql server other resources

Solution

Not seeing the SQL Server Agent on the Other Resources section of the SQL Server cluster resource group means that it has not been created successfully. This is usually caused by an incomplete or corrupt installation when you perform a single-node cluster installation of SQL Server. In this particular case, the single-node cluster installation failed because the virtual server name could not be registered to the DNS. You can verify this by trying to add a new resource in the clustered resource group. In the screenshot below, you do not see the SQL Server Agent in the list of available resources - only the SQL Server resource is available.

add a sql server resource to a cluster

While searching for a Microsoft KB article that would provide a resolution for this issue, I saw a problem similar to mine that was posted on the MSDN Forums.

We can manually add the SQL Server Agent as a clustered resource type. But before we do this, we need to make sure that the SQAGTRES.DLL file has already been copied to the C:\WINDOWS\SYSTEM32 folder. This DLL file gets copied as part of the failover cluster installation together with the main DLL used by the SQL Server database engine - SQSRVRES.DLL. While the functions of these two Resource DLLs are beyond the scope of this tip, you can learn more from this SQL-Server-Performance.com article.

To fix the SQL Server Agent resource on the clustered resource group, you need to perform the following steps below:

NOTE: These steps can be performed either via the Failover Cluster Manager, cluster.exe or Windows PowerShell. Since we all have different preferences, you decide which method to use. I am including all three options where applicable. When choosing to use Windows PowerShell, make sure you import the Windows PowerShell modules, in particular, the FailoverClusters module using the Import-Module cmdlet as defined here.


Manually add the SQL Server Agent resource type to the SQL Server cluster resource group

Step 1
Create the SQL Server Agent resource type

Using cluster.exe,

cluster.exe restype "SQL Server Agent" /create /DLL:SQAGTRES.DLL

cluster.exe Create the SQL Server Agent resource type

Using Windows PowerShell,

Add-ClusterResourceType "SQL Server Agent" C:\Windows\system32\SQAGTRES.DLL

powershell Create the SQL Server Agent resource type

Step 2
Add the SQL Server Agent resource to the SQL Server Cluster Resource Group.

Using the Failover Cluster Manager, right-click on the SQL Server cluster resource group, select Add a resource -> More resources ... -> A - Add SQL Server Agent

cluster manager dd the SQL Server Agent resource to the SQL Server Cluster Resource Group

Using cluster.exe,

cluster resource "SQL Server Agent" /create /group:"SQL Server (MSSQLSERVER)" /type:"SQL Server Agent"

cluster.exe dd the SQL Server Agent resource to the SQL Server Cluster Resource Group

Using Windows PowerShell,

Add-ClusterResource -Name "SQL Server Agent" -ResourceType "SQL Server Agent" -Group "SQL Server (MSSQLSERVER)"

powershell dd the SQL Server Agent resource to the SQL Server Cluster Resource Group

Step 3
Set the private properties of the SQL Server Agent resource.

We need to assign the VirtualServerName and InstanceName properties of the SQL Server Agent resource to match those of the SQL Server resource. In my environment, the VirtualServerName property is SQLCLUS and the InstanceName is MSSQLSERVER since I am using a default instance.

Using the Failover Cluster Manager, double-click the SQL Server Agent resource to open up the Properties window. Click on the Properties tab to display the VirtualServerName and InstanceName properties. Enter the appropriate values for the properties and click OK.

cluseter manager Set the private properties of the SQL Server Agent resource.

Using cluster.exe,

cluster resource "SQL Server Agent" /priv VirtualServerName=SQLCLUS
cluster resource "SQL Server Agent" /priv InstanceName=MSSQLSERVER

cluster.exe Set the private properties of the SQL Server Agent resource.

Using Windows PowerShell,

Get-ClusterResource "SQL Server Agent" | Set-ClusterParameter VirtualServerName SQLCLUS
Get-ClusterResource "SQL Server Agent" | Set-ClusterParameter InstanceName MSSQLSERVER

powershell Set the private properties of the SQL Server Agent resource.

Step 4
Add the SQL Server resource as a dependency for the SQL Server Agent resource you just created.

This is the same as adding the SQL Server service as a dependency to the SQL Server Agent service in a stand-alone instance.

Using the Failover Cluster Manager, click on the Dependencies tab of the SQL Server Agent Properties dialog box and select SQL Server under the Resource drop-down list. Click OK.

cluster manager Add the SQL Server resource as a dependency for the SQL Server Agent resource you just created

Using cluster.exe,

cluster resource "SQL Server Agent" /adddep:"SQL Server"

cluster.exe Add the SQL Server resource as a dependency for the SQL Server Agent resource you just created

Using Windows PowerShell,

Add-ClusterResourceDependency "SQL Server Agent" "SQL Server"

powershell Add the SQL Server resource as a dependency for the SQL Server Agent resource you just created

You can also verify if the SQL Server Agent resource has all of the nodes in the cluster listed as possible resource owner. Usually, if this is done correctly at the cluster resource group level, all of the resource types inherit the settings.

Using the Failover Cluster Manager, click on the Advanced Policies tab of the SQL Server Agent Properties dialog box to see the list of Possible Owners.

Cluster Manage list of Possible Owners

Using cluster.exe,

cluster resource "SQL Server Agent" /listowners"

cluster.exe  list of Possible Owners

Using Windows PowerShell,

Get-ClusterResource "SQL Server Agent" | Get-ClusterOwnerNode

powershell  list of Possible Owners

Modifying SQL Server registry keys

Having an incomplete or corrupted SQL Server installation also means that there are registry keys that have not been properly written or updated. It is important to backup your registry prior to performing these tasks.

  1. Open the Registry Editor and navigate to the following registry hives.

    For default instance:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\ConfigurationState

    For a named Instance
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft Microsoft SQL Server\MSSQL10_50.INSTANCENAME\ConfigurationState

  2. Check the values of all the registry keys. If the value is greater than 1, it means that there was a failure either during the installation or configuration phase while running the setup process. In my environment, all of the registry keys have a value of 2.
     
    Modifying SQL Server registry keys

  3. Change all of the registry key values to 1.
    Modifying SQL Server registry keys

    Modifying SQL Server registry keys

Run a Repair of the SQL Server 2008 R2 installation

After all of the ground work has been done, you can now perform a repair of the SQL Server instance. To do this, run the setup.exe from the SQL Server 2008 R2 installation media and click the Maintenance link on the left-hand side. You can then click the Repair link to run the repair process. A more detailed procedure is defined here.

NOTE: Make sure that you run the repair process on the node that does not own the SQL Server cluster resource group, or in other words, the passive node. If you are, manually fail over the SQL Server cluster resource group to the other node before proceeding with the repair.

Run a Repair of the SQL Server 2008 R2 installation

Bring the SQL Server Agent Resource Online

Once the repair process completes successfully, you can now bring the SQL Server Agent resource online.

Using the Failover Cluster Manager, right-click the SQL Server Agent resource and select Bring this resource online option.

failover manager Bring the SQL Server Agent Resource Online

Using cluster.exe,

cluster resource "SQL Server Agent" /online

cluster.exe Bring the SQL Server Agent Resource Online

Using Windows PowerShell,

Start-ClusterResource "SQL Server Agent"

powershell Bring the SQL Server Agent Resource Online

Next Steps



Related Tips: More | Become a paid author


Last Update: 1/19/2012

Share: Share 






Comments and Feedback:

Friday, January 20, 2012 - 1:59:09 PM - sreekanth read the tip flag as SPAM

Very Nice Info Edwin! Really appreciated:)

Just Curios - What if we coudn't locate SQAGTRES.DLL file in system32 Folder? Can we copy that DLL from some other Cluster(of course with the same SQL Build). What if we don't have any other Clusters with the same build? Also, are you aware of any DLL's which we should be looking for in "SysWOW64" folder if we are running on X64 machines?


Wednesday, January 25, 2012 - 3:37:39 PM - bass_player read the tip flag as SPAM

There are a few considerations for this tip. First, if this is a non-production server, I would recommend starting from scratch to keep things clean. My philosophy has been to make sure to get things right the first time so that you don't have to worry about support and administrative issues down the road. If this happened on a production machine - for example, one specific scenario is while installing a service pack - this means that the SQAGTRES.DLL file is already there because it was working prior to installing the service pack. And I certainly do not recommend implementing a workaround that does not fall under a supported scenario


Monday, February 06, 2012 - 10:30:17 AM - Dennixx read the tip flag as SPAM

Great article, thanks!

I had only one question: Should the repair process be done for each node in the cluster (failing over in between)? Or is it sufficient to do it only once?


Monday, February 06, 2012 - 3:08:30 PM - bass_player read the tip flag as SPAM

There are a couple of scenarios where you need to run the repair process. One scenario, which was highlighted in the article, was creating a new SQL Server failover cluster. This means that you only have one cluster to begin with. If this is the case, you only need to run the repair process on the first node. Another scenario is when you are trying to install a service pack. Since the process of installing a service pack/cumulative update has changed in SQL Server 2008 Failover Cluster on Windows Server 2008, you will be starting off from the passive/inactive node. If this process fails, you only need to run the repair process on the affected node. The ultimate test of checking whether the repair process worked or not is to manually failover the SQL Server clustered resource group on all of the nodes in the cluster and review both Windows and SQL Server error logs.



Post a Comment or Question

Keep it clean and stay on the subject or we may delete your comment.
Your email address is not published. Required fields are marked with an asterisk (*)

*Name   *Email   Notify for updates
Comments
*Enter Code refresh code


 
Sponsor Information
Try the free performance monitoring tool from Idera!

Optimize your SQL Server storage: compress live databases by up to 90%. Download a free trial.

SQL Server Issues? Not sure where to turn for answers? Innovative SQL DBA consultants

Solving SQL Server problems for millions of DBAs and Devs since 2006. Join now.

Free Web Cast - What Are You Waiting For? Delivered by Jason Strate on Wednesday, March 14 @ 3:00 PM EST


Copyright (c) 2006-2012 Edgewood Solutions, LLC All rights reserved
privacy | disclaimer | copyright | advertise | about
authors | contribute | feedback | giveaways | user groups
Some names and products listed are the registered trademarks of their respective owners.


Edgewood Solutions LLC | MSSharePointTips.com | MSSQLTips.com