SQL Server Error 1472 Mirroring Connection Terminated
In this article
SQL Server Error 1472 occurs when the database mirroring connection is unexpectedly terminated, typically due to a network timeout, a firewall blocking the communication port, or a failure in the service account permissions. To resolve this, you must verify that the mirroring endpoints are started, ensure the SQL Server service accounts have the necessary connect permissions on both the principal and mirror servers, and confirm that the network allows traffic through the specific TCP port assigned to mirroring.
What You'll Need
- Administrative access to both the Principal and Mirror SQL Server instances.
- System Administrator (sysadmin) privileges within SQL Server.
- Access to the Windows Firewall or network security group settings for both servers.
- Knowledge of the TCP port number configured for the mirroring endpoints (default is often 5022).
- The names of the service accounts running the SQL Server services on both machines.
Step-by-Step
- Identify the Endpoint Port: First, determine which port is being used for mirroring. Open SQL Server Management Studio (SSMS) and run the following query on both the principal and mirror servers:
SELECT name, port, state_desc FROM sys.database_mirroring_endpoints;. Note the port number; if no endpoint exists, you will need to create one before proceeding. - Verify Endpoint State: Check the
state_desccolumn from the previous query. If the state is not 'STARTED', the mirroring connection will fail immediately. You can start the endpoint using the command:ALTER ENDPOINT [YourEndpointName] STATE = STARTED;. Ensure this is done on both servers. - Validate Service Account Permissions: SQL Server mirroring requires the service accounts to be able to connect to the endpoints. If you are using domain accounts, ensure the account running the SQL Server service on Server A has
CONNECTpermission on the endpoint of Server B, and vice versa. Execute:GRANT CONNECT ON ENDPOINT::[YourEndpointName] TO [Domain\ServiceAccount];. If you are using local accounts or certificates, ensure the certificates are correctly installed and trusted on both ends. - Configure Windows Firewall: The mirroring port (e.g., 5022) must be open for inbound and outbound traffic. Open the Windows Firewall with Advanced Security. Create a new 'Inbound Rule' for a 'Port', select 'TCP', enter the mirroring port number, and set it to 'Allow the connection'. Repeat this process on both the principal and mirror servers.
- Test Network Connectivity: Use a tool like PowerShell to verify that the port is actually reachable across the network. From the principal server, run:
Test-NetConnection -ComputerName [MirrorServerName] -Port 5022. If the result forTcpTestSucceededis False, there is still a network block or the service is not listening on that port. - Check for TCP Chimney Offload: In some high-traffic environments, Windows TCP Chimney Offload can cause intermittent connection drops that trigger Error 1472. Open a Command Prompt as Administrator and run:
netsh int tcp set global chimney=disabled. This forces the CPU to handle the packet processing rather than the NIC, which often stabilizes mirroring connections. - Review Mirroring Partner Settings: Ensure the mirroring partners are correctly defined. On the principal server, check the mirroring properties of the database. Verify that the mirror server's endpoint URL is correctly formatted as
TCP://ServerName:Port. A typo in the server name or port here will lead to a termination error. - Restart the Mirroring Session: After applying these fixes, you may need to reset the mirroring state to clear the error. You can do this by removing the mirroring partner on the principal and then re-establishing the connection. Use:
ALTER DATABASE [DatabaseName] SET PARTNER OFF;and then re-run the setup process to join the mirror.
Common Mistakes
One of the most frequent mistakes is assuming that because the SQL Server instance is accessible via SSMS (which uses port 1433), the mirroring endpoint is also accessible. Mirroring uses a separate endpoint and a separate port; opening 1433 does nothing for Error 1472. Another common error is forgetting to grant CONNECT permissions to the service account. Many administrators grant sysadmin rights to the account but forget that endpoint permissions are handled separately in the security hierarchy.
Additionally, users often overlook the difference between the SQL Server service account and the user account they are using to run the scripts. The permissions must be granted to the account that the service is running as, not the person performing the configuration. Finally, failing to disable TCP Chimney Offload or RSS (Receive Side Scaling) on older network cards often leads to "ghost" disconnects where the connection works for an hour and then suddenly terminates with Error 1472.
Tips
To prevent future occurrences, consider using a dedicated VLAN for mirroring traffic to reduce network congestion and latency. High latency between the principal and mirror can cause the heartbeat to fail, leading the system to believe the connection has been terminated. Monitoring the SQL Server Error Log on both servers simultaneously is the fastest way to find the root cause; if the principal says "Connection terminated" and the mirror says "Login failed for user," you know the issue is permission-based rather than network-based.
When configuring endpoints, always use a static port rather than allowing the system to assign one dynamically. This makes firewall management significantly easier and ensures that after a server reboot, the mirroring connection can automatically resume without needing a manual port update. Also, ensure that the DNS resolution is working perfectly; using IP addresses in the endpoint URL can sometimes bypass DNS issues, but it makes server migration more difficult later.
Troubleshooting
If the connection still terminates after following the steps above, start by checking the SQL Server Error Log for specific login failure codes. If you see an error related to "Certificate chain was issued by an authority that is not trusted," your issue is with the SSL/TLS certificates used for the endpoint. You must ensure that the certificates are exported from the source and imported into the trusted root store of the destination server.
If the network test (Test-NetConnection) succeeds but the mirroring still fails, check for third-party antivirus or endpoint security software. Some security suites have "Intrusion Prevention Systems" (IPS) that flag the continuous stream of mirroring data as a potential Denial of Service (DoS) attack and silently drop the connection. Try temporarily disabling the security software to see if the connection stabilizes.
In cases where the error occurs only during heavy load (like a large index rebuild), the issue is likely a timeout. You can attempt to increase the mirroring timeout settings, though these are limited. The best approach in this scenario is to check for network packet loss using a tool like Ping with a large packet size to see if the network hardware is dropping fragmented packets.
Frequently Asked Questions
Does Error 1472 mean my data is lost?
No, Error 1472 is a connectivity error. It means the communication channel between the two servers has broken, but the data residing in the databases remains intact. However, the mirror database will stop being updated until the connection is restored.
Can I use the same port for mirroring and the main SQL instance?
No, the mirroring endpoint must use a different port than the default SQL Server instance port (1433). Using the same port will cause a conflict, and the endpoint will fail to start.
Why does the connection work initially and then drop?
This is usually caused by network instability, TCP Chimney Offload settings, or a firewall that identifies the long-lived connection as idle and kills it. Check your network equipment's "idle timeout" settings.
What is the difference between a service account and a login for mirroring?
The service account is the Windows account that runs the sqlservr.exe process. For mirroring, SQL Server uses this account to authenticate the connection between servers. This is distinct from the SQL logins used by applications to query data.
Do I need to restart the whole server after changing firewall rules?
No, Windows Firewall rules take effect immediately upon clicking "Apply." You do not need to reboot the server or restart the SQL Server service for the port to open.
Will updating SQL Server fix Error 1472?
While updates can fix rare bugs, Error 1472 is almost always a configuration or environmental issue. Updating the software is unlikely to fix a blocked port or a missing permission.