原文链接

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
posted on 2014-12-24 17:23  查祝兆  阅读(675)  评论(1编辑  收藏  举报