Issue Configuring SQL Mirroring for Lync Server 2013 when SQL Witness is Defined But Not Available
I ran into an interesting issue while trying to setup SQL mirroring with a witness in my lab. When installing the databases and setting up mirroring in Topology Builder:
The wizard kept failing when trying to setup the mirror:
Looking at the log file I saw the following errors listed:
Error: DsRoleGetPrimaryDomainInformation failed with error "6BA".
Error: An error occurred: "Microsoft.Rtc.Management.ADConnect.CannotGetDomainInfoException" "DsRoleGetPrimaryDomainInformation failed with error "6BA"."
Unfortunately neither of the error messages provided much useful information on why the error was occurring. I made sure that connectivity to Active Directory was OK and that my Domain Controllers were working properly since the error message made reference to AD. With everything checking out OK and the Install Database wizard still failing in Topology Builder, I decided to run the command manually from the Lync Server Management Shell. Since I was setting up mirroring, Topology Builder was running the Install-CsMirrorDatabase cmdlet. So, I ran that cmdlet from the Lync Server Management Shell using the appropriate parameters as well as including the Verbose parameter. You can find all of the parameters documented in the Install-CsMirrorDatabase TechNet article. Even though the cmdlet failed, this time the error message provided in PowerShell gave me enough information to help me solve the issue:
Install-CsMirrorDatabase : Command execution failed: Cannot setup mirroring because there is an error validating the version of the SQL Server instances. Verify that the SQL Server instances are available. Exception: Microsoft.SqlServer.Management.Common.ConnectionFailureException: Failed to connect to server LAB-SQL-WIT.lab.deitterick.com\SQLEXPRESS. --->
System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
From the error message above, you can see that the error was actually happening while trying to connect to the SQL witness. In this case I had installed SQL Express in my lab to act as the SQL witness. Once I saw the error message I remembered that SQL Express doesn't allow remote connections by default. In order to allow remote connections I needed to open SQL Server Configuration Manager, expand SQL Server Network Configurations, click on Protocols for SQLEXPRESS, and set TCP/IP to Enabled:
With TCP/IP enabled, this time when running the Install Database wizard from Topology Builder, I was able to successfully complete setting up SQL mirroring with a witness:
So while this time the log files weren't as much help in solving the issue, it is important to remember that when you are troubleshooting an issue in Lync, take advantage of all of the information that you can, between errors in the GUI, log files/tracing, and PowerShell, in order to help you solve any issues that you run into.