Smart Systems for Home

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

SQL Server Error 1493: Fix Database Mirroring Setup

· 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

Error 1493 means SQL Server refused to enable mirroring because the database is not in the FULL recovery model, or because a full backup and a subsequent log backup have not been taken since the database was created or switched to FULL. Mirroring relies on the transaction log stream, so without those two backups the log chain is incomplete and the principal cannot ship changes. The fix is to switch the database to FULL recovery, take a full backup, take a log backup, and then configure the mirror. This guide covers the exact steps, the mistakes that keep the error coming back, and what to check when the wizard still fails.

What You'll Need

  • SQL Server Management Studio (SSMS) or sqlcmd connected to the principal server instance.
  • An account with ALTER DATABASE and BACKUP DATABASE permissions on the database, plus sysadmin or db_owner as appropriate.
  • A backup destination folder that the SQL Server service account can write to, with enough free space for a full backup.
  • The mirror server instance prepared with a matching database name and a restore of the full and log backups (WITH NORECOVERY).
  • Endpoints and logins already created on both instances if you have not done that yet.

Step-by-Step

  1. Confirm the current recovery model. In SSMS, right-click the database, choose Properties, and open the Options page. The Recovery model dropdown shows the current setting. If it says SIMPLE or BULK_LOGGED, that alone explains error 1493. You can also run SELECT name, recovery_model_desc FROM sys.databases WHERE name = 'YourDB'; in a query window.
  2. Switch the database to FULL recovery. Run ALTER DATABASE [YourDB] SET RECOVERY FULL; against the principal instance. This changes the model but does not by itself create a usable log chain.
  3. Take a full backup. Run BACKUP DATABASE [YourDB] TO DISK = 'C:\Backups\YourDB_full.bak' WITH INIT, CHECKSUM;. Adjust the path to a folder the service account can write to. This backup becomes the base of the log chain.
  4. Take a log backup immediately after the full backup. Run BACKUP LOG [YourDB] TO DISK = 'C:\Backups\YourDB_log.trn' WITH INIT, CHECKSUM;. The log backup is the step most people skip, and it is the one error 1493 is really complaining about. Without it, the log chain is still considered broken for mirroring purposes.
  5. Verify the log chain is intact. Run SELECT name, log_reuse_wait_desc FROM sys.databases WHERE name = 'YourDB';. It should not report LOG_BACKUP as the blocking reason after a successful log backup. You can also check sys.database_recovery_status for the last log backup time.
  6. Prepare the mirror database on the mirror instance. Restore the full backup with RESTORE DATABASE [YourDB] FROM DISK = 'C:\Backups\YourDB_full.bak' WITH NORECOVERY; and then restore the log backup with RESTORE LOG [YourDB] FROM DISK = 'C:\Backups\YourDB_log.trn' WITH NORECOVERY;. The NORECOVERY option is mandatory; a database restored WITH RECOVERY cannot be a mirror.
  7. Create the database mirroring endpoint on both instances if it does not exist. Run CREATE ENDPOINT Mirroring STATE = STARTED AS TCP (LISTENER_PORT = 5022) FOR DATABASE_MIRRORING (ROLE = PARTNER); on each server. If an endpoint already exists, confirm it is started with SELECT name, state_desc FROM sys.endpoints WHERE type_desc = 'DATABASE_MIRRORING';.
  8. Configure the mirror from the principal. In SSMS, right-click the database, choose Tasks, then Mirror, and click Configure Security. Walk through the wizard: it asks for a witness (optional), then the principal and mirror server addresses and credentials. On the final screen choose Start Mirroring. Alternatively, run ALTER DATABASE [YourDB] SET PARTNER = 'TCP://MirrorServer:5022'; on the principal and the reciprocal statement on the mirror.
  9. Confirm the state. Run SELECT database_id, mirroring_state_desc, mirroring_role_desc FROM sys.database_mirroring WHERE database_id = DB_ID('YourDB');. A healthy pair shows SYNCHRONIZED (or SYNCHRONIZING while it catches up).

Common Mistakes

  • Switching to FULL recovery but never taking a log backup. The model change alone does not satisfy mirroring; the log backup is what closes the chain.
  • Restoring the mirror copy WITH RECOVERY instead of WITH NORECOVERY. The mirror database must stay in restoring state.
  • Taking the full backup before switching to FULL recovery, then expecting it to count. Take the full backup after the model change, then the log backup.
  • Using a database name on the mirror that differs from the principal. Mirroring requires identical database names on both sides.
  • Forgetting that the mirror endpoint must be started and reachable on the port you specify. A firewall blocking port 5022 produces a different error later, but it is easy to conflate with 1493 during setup.
  • Running the ALTER DATABASE SET PARTNER statement on the wrong instance. The principal points at the mirror and the mirror points at the principal.

Tips

  • Run the full and log backups back to back so the log backup captures only a small amount of activity, which shortens the catch-up time on the mirror.
  • Keep the backup files on the mirror server accessible to the SQL Server service account; a permissions failure on the restore looks like a mirroring problem but is not.
  • Check log_reuse_wait_desc after the log backup. If it still shows LOG_BACKUP, another log backup is pending or the backup did not complete.
  • If you use the SSMS Mirror wizard, have the mirror server name and port ready before you start; the wizard does not save partial progress.
  • Labels in SSMS can differ slightly by version and by whether you use the Object Explorer or a query window, so match on the action rather than the exact wording.

Troubleshooting

If error 1493 persists after the steps above, work through these checks in order. First, re-run the recovery model query and confirm it returns FULL, not BULK_LOGGED; a later bulk operation can switch the model back if someone changed it. Second, confirm a log backup has completed since the last full backup by checking sys.database_recovery_status or the backup history tables. Third, confirm the mirror database is still in RESTORING state with SELECT state_desc FROM sys.databases WHERE name = 'YourDB'; on the mirror instance; if it says ONLINE, the restore was done WITH RECOVERY and must be redone. Fourth, check that the principal and mirror are the same SQL Server major version and edition that supports mirroring, and that the database is not part of an Availability Group, which supersedes mirroring. Fifth, if the wizard fails at the endpoint stage, verify the endpoint is STARTED and that the service account has CONNECT permission on it. Finally, if the error appears only when starting mirroring, capture the full error text; 1493 is sometimes accompanied by a second error that points to the real cause, such as a permissions or network issue.

Frequently Asked Questions

Does switching to FULL recovery fix error 1493 on its own?

No. The database must be in FULL recovery and must have a full backup plus a log backup taken after the switch. The model change alone leaves the log chain incomplete.

Can I use SIMPLE recovery with database mirroring?

No. Mirroring requires the FULL recovery model because it depends on the transaction log stream. SIMPLE truncates the log and breaks that stream.

Why does the mirror database need WITH NORECOVERY?

A database restored WITH RECOVERY is online and cannot accept the continuous log stream that mirroring sends. WITH NORECOVERY keeps it in restoring state so it can apply incoming log records.

Do I need a witness server?

No. A witness enables automatic failover in high-safety mode. You can configure mirroring without one and fail over manually.

Can I mirror a database that is in an Availability Group?

No. A database cannot be both a mirroring partner and an Availability Group database. Use one high-availability technology per database.

What if the log backup completes but 1493 still appears?

Check that the backup ran against the same database on the principal instance, that the mirror copy is still restoring, and that both instances are the same version. The full error message usually names the specific blocker.