Sample Header Ad - 728x90

ADO.NET client occasionally attempts connection to SQL Server mirror partner even when principal is online

0 votes
1 answer
52 views
We're running SQL Server 2016 Standard Edition with database mirroring in synchronous mode and automatic failover enabled. Our .NET applications use connection strings with Failover Partner. Occasionally (1–4× per day), some applications try to connect to the mirror server, even though the principal is online and fully healthy. We see login failures on the mirror (Error 4060 – "Cannot open database ...") but no issues or alerts on the principal side (Redgate, Zabbix, SQL logs, etc.). This affects different databases (we have dozens mirrored) and different apps or users – it’s not tied to one specific service. Extended Events show only mirror-side errors, with various client hosts and application names. PerfMon once showed a spike in TCP hard connects around the same time, but nothing consistent. Based on online research such as [Database mirroring login failure attempts on mirror server](https://serverfault.com/questions/236163) , we suspect it may be caused by things like expired connections in the pool, network hiccups, SQL Browser issues, or connection resets (e.g. firewall/NAT dropping idle sockets). When this happens, the .NET SqlClient might believe the primary is unreachable and trigger an immediate failover attempt. So far this seems to be expected behavior, but it causes false-positive alerts in our monitoring tools. We're trying to confirm: 1) Is this behavior expected from ADO.NET when Failover Partner is used? 2) Is there any way to reduce/suppress the probing of the mirror? 3) Are there best practices for detecting/logging/tuning this (e.g., connection settings, retry logic)? 4) Should we just tune our monitoring and ignore these errors as “normal noise”?
Asked by Jan (1 rep)
Jul 17, 2025, 02:57 PM
Last activity: Jul 18, 2025, 01:27 AM