Fix it now
The partner address you gave could not be reached. Error 1418 is published as the server network address not being reachable or not existing, with the advice to check the address name and that the ports for the local and remote endpoints are operational. That is a network, endpoint or permission problem, not a problem with the database you are mirroring.
SELECT e.name, e.state_desc, e.role_desc, t.port
FROM sys.database_mirroring_endpoints e
JOIN sys.tcp_endpoints t ON e.endpoint_id = t.endpoint_id;
ALTER ENDPOINT [Mirroring] STATE = STARTED;
- Read the port from that query on each side rather than assuming one. The endpoint listens on whatever port it was created with, and it has to be unique on that machine.
- Test the path in both directions on those ports, for example
Test-NetConnection partner.contoso.local -Port 5022in PowerShell, adjusting the port to what the query returned. - Give each side’s service account a login on the other and grant it connect permission:
GRANT CONNECT ON ENDPOINT::[Mirroring] TO [DOMAIN\SQLSvc];. Both directions are needed, because the partners connect to each other. - Set the partner with a fully qualified name and the endpoint port:
ALTER DATABASE [YourDb] SET PARTNER = 'TCP://mirror.contoso.local:5022';, on the mirror first and then on the principal.
If either instance runs under a non-domain account, Windows authentication has nothing to validate against and the documented answer is certificate authentication on the endpoints rather than a login grant.
If the session reaches a synchronised state, stop here. If the command still fails, the next section works through the four things the handshake needs.
Why it happens
Mirroring does not use the port your applications connect on. Each instance publishes a dedicated endpoint listening on its own port, and the partners connect to each other across it. Because the connection is made in both directions, a firewall rule or a permission that exists on only one side produces exactly the same 1418 as having no endpoint at all, which is why testing one direction proves very little.
Authentication across that endpoint uses Windows by default. Each instance’s service account needs a login on the partner instance with permission to connect to the endpoint. Microsoft’s rule for the awkward cases is explicit: where SQL Server runs under a non-domain account you must use certificates, and where it runs as Network Service you can connect using the machine account, which then has to be added as a user on the other instance.
The related codes describe the same conversation failing at other points, and their published texts are more precise than the paraphrases people repeat. Error 1413 says communications to the remote server instance failed before database mirroring was fully started, that the ALTER DATABASE command failed, and to retry when the remote database is started. Error 1431 says neither the partner nor the witness server instance is available, and to reissue the command when at least one becomes available.
Error 1456 is the configuration-change failure: the ALTER DATABASE command could not be sent to the named remote instance, the mirroring configuration was not changed, and you should verify the server is connected and try again. In practice you meet it most often when adding a witness that is not reachable, but the message is about any change that could not be delivered.
The endpoint is stopped or was never created
You have this one if The endpoint query returns nothing, or a state that is not STARTED, on one of the instances.
- Create it if it is missing, choosing a free port and the right role:
CREATE ENDPOINT [Mirroring] STATE = STARTED AS TCP (LISTENER_PORT = 5022) FOR DATABASE_MIRRORING (ROLE = PARTNER); - If it exists but is stopped, run
ALTER ENDPOINT [Mirroring] STATE = STARTED; - Check the role. The documented values are PARTNER, WITNESS and ALL, and an instance that must act in both capacities needs ALL.
There is one database mirroring endpoint per instance, not per database. Creating a second one is not the fix for a second mirrored database.
The port is blocked between the servers
You have this one if The endpoint is STARTED on both sides but the port test fails in at least one direction.
- Add an inbound firewall rule on each server for the endpoint port that instance reported, restricted to the partner addresses.
- Ask the network team to confirm no access list between the subnets drops that port.
- Retest in both directions before touching the mirroring commands again.
The service account cannot connect to the endpoint
You have this one if The port test succeeds both ways and the command still fails immediately with 1418.
- On each instance, create a login for the partner instance’s service account and grant it CONNECT on the endpoint.
- If an instance runs as Network Service, use the machine account, which has to be added as a user on the other instance.
- Recheck by connecting to each instance and confirming both the login and the grant exist.
Across domains without trust, or in a workgroup, build the endpoints for certificate authentication instead. Windows authentication has nothing to validate against there.
The partner string is wrong
You have this one if Everything tests clean and the command still cannot reach the partner, and the name in the command is short or points at a cluster name.
- Use the fully qualified domain name of the instance’s host, with the endpoint port after a colon.
- For a named instance, remember the address is the host name and the endpoint port, not the instance name.
- Confirm the name resolves from the other server before you re-issue the command.
The database is not in a state that allows mirroring
You have this one if The endpoints are healthy and reachable, but the command is refused as soon as the database is named.
- Confirm the database uses the full recovery model on the principal.
- Confirm the mirror copy was restored from a full backup plus every subsequent log backup, all with NORECOVERY, and is sitting in a restoring state.
- Set the partner on the mirror first, then on the principal.
Full reference
Working out which side is at fault
| Test | What the result tells you |
|---|---|
| The endpoint is not STARTED on either side | Start it; nothing else will work until you do |
| The port test fails one way only | A firewall rule or a listener exists on one side only |
| The port test succeeds and 1418 persists | Endpoint permission, or the wrong name in the partner string |
| It works by IP address and fails by name | Name resolution; use the fully qualified name |
| It fails only when adding the witness | The witness is unreachable or its endpoint is not started; expect 1431 or 1456 |
Endpoint anatomy
| Clause | Values | Notes |
|---|---|---|
STATE |
STARTED, STOPPED, DISABLED |
A stopped endpoint answers nothing and produces 1418 |
AS TCP (LISTENER_PORT = n) |
Any free port | Must be unique on that machine. Microsoft’s documented example uses 7022; read the actual value from sys.tcp_endpoints rather than assuming |
ROLE |
PARTNER, WITNESS, ALL |
PARTNER for the two data-carrying instances, WITNESS for the third, ALL to be either |
AUTHENTICATION |
Windows, or certificate | Certificates are required when SQL Server runs under a non-domain account |
ENCRYPTION |
Required by default | Leave it on unless you have a reason and a plan |
The login grant, in both directions
- On the principal, create a login for the mirror instance’s service account and grant it CONNECT on the mirroring endpoint.
- On the mirror, do the same for the principal’s service account.
- If there is a witness, both partners’ accounts need the same treatment on it, and it needs theirs.
- Where an instance runs as Network Service, use its machine account and add it as a user on the other instance.
- Where an instance runs under a non-domain account, stop and build certificate authentication instead.
Diagnosing without changing anything
- Read the state and port from the endpoint query on both machines before you change a setting; half the reported cases are a stopped endpoint on one side.
- Test the port from the partner’s subnet. A test from the server itself proves almost nothing.
- Check the SQL Server error log on both sides at the moment of the failure; the partner often logs a clearer reason than the machine you ran the command on.
- Confirm the two instances are at compatible builds before you spend time on the network.
Where mirroring is heading
Database mirroring is documented as a deprecated feature. For an existing pair that works there is no urgency, but nothing new should be built on it, and the replacement is availability groups. That matters here because the replacement is not edition-neutral: in SQL Server 2025 the full availability group feature is Enterprise, while Standard offers a basic availability group of two replicas with a single database. A pair of Standard instances mirroring one database today maps onto a basic availability group reasonably well; a pair carrying several databases does not.
When a licence is the actual fix
Nothing above costs anything: endpoints, ports, names and permissions are all configuration. The edition boundaries are worth knowing before you rebuild, though. The SQL Server 2025 edition table lists database mirroring as available on Enterprise, on Standard with full safety only, and on Express as a witness only, and marks the feature as deprecated. Its replacement is availability groups, which are Enterprise in 2025; Standard gets basic availability groups, documented as two replicas with one database, a secondary that is not readable and no backups on the secondary. If you are rebuilding this pair rather than repairing it, Arco can supply SQL Server 2025 Standard (2-core pack) licences and talk through which edition the configuration you actually want requires.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
1418 |
The server network address cannot be reached or does not exist; check the address name and that the ports for the local and remote endpoints are operational | Microsoft Learn |
1413 |
Communications to the remote server instance failed before database mirroring was fully started, so the ALTER DATABASE command failed; retry when the remote database is started | Microsoft Learn |
1431 |
Neither the partner nor the witness server instance is available; reissue the command when at least one becomes available | Microsoft Learn |
1456 |
The ALTER DATABASE command could not be sent to the named remote instance and the mirroring configuration was not changed; verify the server is connected and try again | Microsoft Learn |
Confirm the fix worked
- The mirroring state reports synchronised on both partners.
- Both endpoints report STARTED and the port each one is meant to use.
- A port test succeeds in both directions from the partners’ own subnets.
- A planned failover during a maintenance window swaps the roles cleanly.
- Failing back re-establishes the session without manual intervention.
Questions people ask about this
Does the endpoint port have to be 5022?
No. The documentation only requires that the port is free and unique on that machine; Microsoft’s own example uses 7022. Read the port from sys.tcp_endpoints rather than assuming, because a wrong assumption here looks exactly like a firewall problem.
Can I mirror between different editions?
It is a poor arrangement. Keep the partners on the same edition and patch level, otherwise a failover can land your workload on an instance that lacks something the database uses. Note also that Standard supports full safety only and Express can act only as the witness.
Do I need to buy anything to clear 1418?
No. This error is endpoints, ports, names and permissions, all free to fix. Licensing only enters the conversation if you decide to replace mirroring with something else.
Should I still be using mirroring at all?
For an existing pair that works, there is no urgency. For anything new, mirroring is documented as deprecated and availability groups are the supported direction. On Standard that means a basic availability group, which is two replicas and one database.
The instances are in a workgroup. Why will the grant not work?
Because Windows authentication across the endpoint needs a domain to validate against. Microsoft’s documented answer for a non-domain account is to use certificates on the endpoints instead.
