Smart Systems for Home

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

SQL Server Error 1492: Fix Database Mirroring Error

· 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 1492 means SQL Server refused to enable database mirroring because the database is not in the FULL recovery model, or because a prerequisite such as a full backup and log backup has not been completed. The fix is to switch the database to FULL recovery, take a full backup and a transaction log backup, then re-run the mirroring setup. You need sysadmin or db_owner rights on both the principal and mirror instances, and the mirror server must already have a copy of the database restored WITH NORECOVERY.

What You'll Need

  • SQL Server Management Studio (SSMS) or sqlcmd access to both the principal and mirror instances.
  • An account with sysadmin or at least db_owner plus ALTER DATABASE rights on both servers.
  • The database name, the mirror server name, and the TCP endpoint (usually port 5022) configured on both instances.
  • A recent full backup and at least one transaction log backup of the principal database.
  • Enough free disk space on the mirror for the restored copy, plus the same drive letter or path layout if you plan to use the wizard.

Menu labels and dialog wording can differ slightly between SSMS versions and SQL Server editions, so treat the paths below as a guide rather than an exact script.

Step-by-Step

  1. Confirm the current recovery model. In SSMS, right-click the database, choose Properties, and open the Options page. If Recovery Model is SIMPLE or BULK_LOGGED, mirroring cannot be enabled. You can also run SELECT name, recovery_model_desc FROM sys.databases WHERE name = 'YourDB'; to check quickly.
  2. Switch to FULL recovery. Run ALTER DATABASE YourDB SET RECOVERY FULL; in a query window against the principal instance. This does not take the database offline, but it does start logging every transaction, so plan for log growth.
  3. Take a full backup. Right-click the database, choose Tasks > Back Up, select Full as the backup type, and write to a file. A full backup after switching to FULL recovery establishes the log chain that mirroring depends on.
  4. Take a transaction log backup. Right-click the database, choose Tasks > Back Up, select Transaction Log as the type, and back up to a separate file. Without this step the mirror will not accept the restore sequence and you will hit error 1418 or 1492 again.
  5. Restore both backups on the mirror instance WITH NORECOVERY. Copy the files to the mirror server, then run RESTORE DATABASE YourDB FROM DISK = 'C:\Backups\YourDB_full.bak' WITH NORECOVERY, REPLACE; followed by RESTORE LOG YourDB FROM DISK = 'C:\Backups\YourDB_log.trn' WITH NORECOVERY;. The database stays in RESTORING state, which is what mirroring expects.
  6. Verify endpoints exist. On each instance run SELECT name, port, state_desc FROM sys.database_mirroring_endpoints;. If none exists, create one with CREATE ENDPOINT Mirroring STATE = STARTED AS TCP (LISTENER_PORT = 5022) FOR DATABASE_MIRRORING (ROLE = ALL);. The mirror uses ROLE = PARTNER and the principal uses ROLE = PARTNER as well; ROLE = ALL is fine for a two-server setup.
  7. Grant CONNECT on the endpoint. The service accounts need permission. Run GRANT CONNECT ON ENDPOINT::Mirroring TO [Domain\SqlServiceAccount]; on both servers, replacing the account with the one SQL Server runs under.
  8. Start mirroring on the mirror first. On the mirror instance run ALTER DATABASE YourDB SET PARTNER = 'TCP://PrincipalServer:5022';. Then on the principal run ALTER DATABASE YourDB SET PARTNER = 'TCP://MirrorServer:5022';. The order matters: the mirror must be listening before the principal connects.
  9. Check the result. Run SELECT mirroring_state_desc, mirroring_role_desc FROM sys.database_mirroring WHERE database_id = DB_ID('YourDB');. You want SYNCHRONIZED or SYNCHRONIZING with the principal as PRINCIPAL.

Common Mistakes

  • Switching to FULL recovery but skipping the log backup. Mirroring needs a log backup to seed the log chain; a full backup alone is not enough.
  • Restoring the mirror copy WITH RECOVERY instead of WITH NORECOVERY. That brings the database online and mirroring cannot attach to it.
  • Running the principal's ALTER DATABASE SET PARTNER before the mirror is listening, which produces a timeout rather than a clean error.
  • Forgetting the endpoint CONNECT grant, so the partner handshake fails even though the endpoint exists.
  • Using a database name that differs between the two servers. The names must match exactly.
  • Assuming the fix is a single ALTER DATABASE statement. Error 1492 is almost always a recovery-model or backup-chain problem, not a syntax problem.

Tips

  • Run the mirror-side restore from a script rather than the SSMS wizard so you can see each WITH NORECOVERY step succeed.
  • Keep the full and log backup files together and label them with the date; you will need them again if you rebuild the mirror.
  • After mirroring is running, set up regular log backups on the principal. Without them the log file grows until the disk fills.
  • Use the same collation and compatibility level on both servers; a mismatch causes failures later during failover.
  • Test failover during a maintenance window before you rely on the mirror in production.

Troubleshooting

If error 1492 persists after switching to FULL recovery, confirm the change actually applied by re-querying sys.databases. A database that is still in SIMPLE mode will keep returning the error. If the error is gone but mirroring will not start, check the SQL Server error log on both instances for endpoint or login failures, and confirm the firewall allows TCP 5022 between the two hosts. If the mirror database is stuck in RESTORING and refuses the partner command, restore the latest log backup again WITH NORECOVERY and retry. If you see error 1418 instead, the endpoint names or ports do not match between servers. When none of that works, remove the partner setting on both sides with ALTER DATABASE YourDB SET PARTNER = OFF;, drop and recreate the endpoints, and start the sequence again from the mirror side. Do not drop the mirror database unless you are prepared to redo the full restore, because dropping it deletes the mirrored copy entirely.

Frequently Asked Questions

Does error 1492 always mean the recovery model is wrong?

No. It can also appear when the required full and log backups have not been taken, so check both the recovery model and the backup chain.

Can I enable mirroring on a SIMPLE recovery database?

No. Database mirroring requires the FULL recovery model because it depends on the transaction log stream.

Will switching to FULL recovery break my application?

No, the change is online and does not interrupt connections, but log growth will increase, so schedule regular log backups.

Do I need to restore the database on the mirror before enabling mirroring?

Yes. The mirror must have a copy restored WITH NORECOVERY from a full backup plus at least one log backup before the partner commands will work.

Why does the mirror database stay in RESTORING state?

That is expected. A mirror database remains in RESTORING until mirroring is configured and synchronization begins.

Can I use the SSMS mirroring wizard instead of T-SQL?

Yes, the Configure Database Mirroring Security Wizard handles endpoints and logins, but you still need the FULL recovery model and the correct backup sequence first.