SQL Database Mirror Failover fails when using custom ports

SQL Database Mirror Failover fails when using custom ports

book

Article ID: CTX240005

calendar_today

Updated On:

Description

Summary

This article describes a failure of the Citrix Virtual Apps and Desktops (CVAD) Controllers to properly failover to a SQL Mirror Failover Partner when the SQL environment is configured to use custom ports.

Details

When configuring a SQL Mirror environment to use custom ports, the CVAD Controllers (DDCs) will not properly failover to the Failover Partner server.

The Controller will simply attempt to communicate with the Failover Partner via the default SQL port of 1433. 

The site will lose connection to the database, triggering an outage. The site may fall into HA mode via the built-in CVAD HA mechanism configured, either Connection Leasing mode (DDCs prior to 7.12) or Local Host Cache failover mode (DDCs 7.12 and higher). 
 

Environment

Citrix is not responsible for and does not endorse or accept any responsibility for the contents or your use of these third party Web sites. Citrix is providing these links to you only as a convenience, and the inclusion of any link does not imply endorsement by Citrix of the linked Web site. It is your responsibility to take precautions to ensure that whatever Web site you use is free of viruses or other harmful items.

Resolution

The admin must configure the SQL client, in this case the DDCs, to communicate to the failover server using the proper port. This is acomplished by defining a SQL alias from the client side.

Follow the instructions below on all DDCs in the site to setup the alias to the SQL server :
  1. Logon to the DDC as a local administrator account
  2. Open a CMD shell as admin
  3. Type: cliconfg and press enter
  4. This will bring up the "SQL Server Client Network Utility"
 
 
  1. Click on the Alias tab and Click "Add" Button
  2. Click the TCP/IP radio button 
  3. Fill in the field 'Server alias' with the Hostname of the SQL server 
  4. Fill in the field 'Server name' again with the Hostname of the SQL server 
  5. uncheck the box for "Dynamically determine port"
  6. In the Port number field, input the custom port number defined in the SQL environment
 
 
  1. Click OK
  2. Repeat on all DDCs in the CVAD site

The admin can verify the change in the Windows registry by following these steps.
  1. Open regedit and navigate to the following Key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo
  1. You will see a new string object for the alias you created similar to the one below:

Problem Cause

This is a Microsoft SQL limitation.

When the failover to the mirror instance happens while the Citrix services are already started, the SQL client on the Delivery Controller receives the information from the SQL server to connect to the mirror without any custom port specified.

Creating a SQL alias which has the same hostname for the 'Server Alias' and the 'Server Name' will make the SQL client automatically append the Custom Port to the hostname.

.

 

Issue/Introduction

This article describes how to troubleshoot a failure of the Citrix Virtual Apps and Desktops (CVAD) Controllers to properly failover to a SQL Mirror Failover Partner if the SQL environment is configured to use custom ports.

Additional Information

As described in msdn http://msdn.microsoft.com/en-us/library/cc917680.aspx

“If the connection to the initial principal server succeeds, then the failover partner name will not be used, but the driver will store the failover partner name that it retrieves from the principal server on the client-side cache.”