Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

SQL Server Error 1494: Fix Database Mirroring

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

SQL Server error 1494 means database mirroring cannot be enabled because the database is not configured to allow remote connections or the mirroring endpoint is not properly set up. In plain terms, one of the two server instances cannot reach the other, or the database is not in the right recovery model. The fix is to verify the recovery model is FULL, ensure both instances have a mirroring endpoint, and confirm that the principal and mirror servers can authenticate and connect to each other. You do not need to reinstall SQL Server; you need to correct the configuration on both instances.

What You'll Need

  • SQL Server Management Studio (SSMS) or sqlcmd access to both the principal and mirror server instances.
  • Sysadmin or server-level permissions on both instances to create endpoints and alter databases.
  • The exact server names (or IP addresses) and port numbers for both instances.
  • A login with CONNECT permissions on the mirroring endpoint on each server.
  • Firewall rules that allow traffic on the mirroring port (default 5022) between the two servers.
  • A recent full backup and transaction log backup of the database you intend to mirror.

Step-by-Step

  1. Check the recovery model on the principal database. In SSMS, right-click the database, choose Properties, then Options. Confirm Recovery model is FULL. If it is SIMPLE or BULK_LOGGED, change it to FULL and take a full backup immediately. Mirroring requires the FULL recovery model.
  2. Verify the mirroring endpoint exists on both instances. Run SELECT name, type_desc, state_desc FROM sys.database_mirroring_endpoints; on each server. If no row returns, create an endpoint on each instance. For the principal: CREATE ENDPOINT Mirroring STATE = STARTED AS TCP (LISTENER_PORT = 5022) FOR DATABASE_MIRRORING (ROLE = PARTNER); Use the same command on the mirror server, but you may set ROLE = PARTNER or leave it as PARTNER with a different port if needed. If the endpoint exists but is stopped, run ALTER ENDPOINT Mirroring STATE = STARTED;.
  3. Confirm the endpoint is listening and reachable. On each server, run SELECT state_desc, port FROM sys.tcp_endpoints WHERE type_desc = 'DATABASE_MIRRORING'; and check that the state is STARTED. Then test connectivity from the principal to the mirror using telnet <mirror_server> 5022 or Test-NetConnection -ComputerName <mirror_server> -Port 5022 in PowerShell. If the connection fails, open the port in Windows Firewall on both servers and check any network firewall between them.
  4. Grant CONNECT permission on the endpoint. The service account or login used by the other server must have CONNECT permission on the mirroring endpoint. On each server, run GRANT CONNECT ON ENDPOINT::Mirroring TO [<login>]; where the login is the account the other instance uses to authenticate. If the instances are in different domains or workgroups, you may need to use certificates; that is more complex, but the same CONNECT grant applies.
  5. Back up and restore the database on the mirror server. Take a full backup and a transaction log backup of the principal database. Restore both on the mirror server using WITH NORECOVERY. For example: RESTORE DATABASE YourDb FROM DISK = 'C:\Backups\YourDb.bak' WITH NORECOVERY; then RESTORE LOG YourDb FROM DISK = 'C:\Backups\YourDb.trn' WITH NORECOVERY;. The database on the mirror must be in RESTORING state, not ONLINE.
  6. Start mirroring from the mirror server first. On the mirror instance, run ALTER DATABASE YourDb SET PARTNER = 'TCP://principal_server:5022';. Then on the principal instance, run ALTER DATABASE YourDb SET PARTNER = 'TCP://mirror_server:5022';. The order matters: configure the mirror partner before the principal partner. If you reverse the order, you may see error 1494 or a related endpoint error.
  7. Verify the mirroring state. Run SELECT database_id, mirroring_state_desc, mirroring_role_desc FROM sys.database_mirroring WHERE database_id = DB_ID('YourDb'); on both servers. The state should show SYNCHRONIZING or SYNCHRONIZED, and the roles should be PRINCIPAL and MIRROR. If it still shows SUSPENDED or DISCONNECTED, check the SQL Server error log on both instances for endpoint or login errors.

Common Mistakes

  • Trying to enable mirroring while the database is in SIMPLE recovery model. Always switch to FULL and take a full backup first.
  • Forgetting to restore the transaction log with NORECOVERY on the mirror. If the database is ONLINE on the mirror, mirroring cannot start.
  • Running the ALTER DATABASE SET PARTNER command on the principal before the mirror. The mirror must be configured first.
  • Using a server name that does not resolve from the other instance. Use the fully qualified domain name or IP address and confirm DNS resolution.
  • Leaving the mirroring endpoint stopped or using a port that is blocked by Windows Firewall.
  • Granting CONNECT to the wrong login. The login must match the security context the other server uses, which is often the SQL Server service account.

Tips

  • Use the same port on both endpoints (5022 is conventional) to keep firewall rules simple.
  • Test connectivity with telnet or Test-NetConnection before you run any ALTER DATABASE commands.
  • Check the SQL Server error log on both instances after each step; it often names the exact endpoint or login that failed.
  • If the servers are in different domains, plan to use certificates for endpoint authentication; Windows authentication alone will not work across untrusted domains.
  • Keep the principal and mirror SQL Server versions and editions compatible; mirroring requires the same edition or higher on the mirror, and the witness (if used) must meet edition requirements.

Troubleshooting

If error 1494 persists after the steps above, work through these checks in order. First, confirm the endpoint state on both servers with SELECT state_desc FROM sys.database_mirroring_endpoints;. If it is STOPPED, start it. Second, verify that the login used by the other instance has CONNECT permission on the endpoint; you can list endpoint permissions with SELECT * FROM sys.server_permissions WHERE major_id = (SELECT endpoint_id FROM sys.endpoints WHERE name = 'Mirroring');. Third, check the Windows Firewall on both servers and any network firewall between them; the mirroring port must be open in both directions. Fourth, confirm the database on the mirror is in RESTORING state by running SELECT state_desc FROM sys.databases WHERE name = 'YourDb';. If it is ONLINE, re-restore the backups with NORECOVERY. Fifth, review the SQL Server error log for messages about endpoint authentication or login failures; these often point to a service account mismatch. If you are using certificates, verify that the certificate on each server is valid and that the login mapped to the certificate has CONNECT permission on the endpoint. Finally, if the instances are in different domains or workgroups, Windows authentication will not work without a trust relationship; use certificates instead. If none of these resolve the error, capture the full error message and the relevant error log entries before contacting support; the exact text often reveals whether the problem is connectivity, authentication, or database state.

Frequently Asked Questions

What does SQL Server error 1494 actually mean?

It means the database cannot be enabled for mirroring because the server instance is not configured to allow remote connections or the mirroring endpoint is missing, stopped, or not reachable. It is a configuration error, not a corruption error.

Can I enable mirroring on a database in SIMPLE recovery model?

No. Database mirroring requires the FULL recovery model. Change the recovery model to FULL and take a full backup before you try again.

Do I need to restore the database on the mirror server first?

Yes. Restore a full backup and at least one transaction log backup on the mirror server using WITH NORECOVERY. The database must be in RESTORING state before you configure the partner.

Which server do I configure first, principal or mirror?

Configure the mirror server first with ALTER DATABASE SET PARTNER pointing to the principal, then configure the principal pointing to the mirror. Reversing the order can cause error 1494 or a related endpoint error.

Does error 1494 mean I need to reinstall SQL Server?

No. It is almost always a configuration issue: recovery model, endpoint state, firewall, or login permissions. Reinstalling will not fix those and is not necessary.

Can I use database mirroring between different SQL Server editions?

Mirroring requires compatible editions; the mirror server must run the same edition or higher than the principal. Check the official documentation for your versions before you start.