Smart Systems for Home

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

SQL Server Error 1476: Fix Mirroring Timeout Value

· 4 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 1476 occurs when the mirroring timeout value you set exceeds the maximum allowed (10 seconds). The fix is simple: set the timeout to 10 seconds or less using the ALTER DATABASE ... SET PARTNER TIMEOUT command. This guide walks you through the exact steps to resolve it, what to check if it persists, and how to avoid common pitfalls.

What You'll Need

  • Access to SQL Server Management Studio (SSMS) or a query editor connected to the SQL Server instance.
  • Permissions to run ALTER DATABASE (typically sysadmin or db_owner).
  • The name of the mirrored database and the current partner server (if known).

Step-by-Step

  1. Identify the database. Run the following query to see which databases are currently configured for mirroring and their timeout values:
    SELECT db.name, db.is_mirroring_enabled, db.mirroring_timeout FROM sys.databases db WHERE db.is_mirroring_enabled = 1;
  2. Check the current timeout. The mirroring_timeout column shows the current timeout in seconds. If it's above 10, that's the cause of error 1476.
  3. Set the timeout to 10 seconds or less. Use the following command, replacing YourDatabase with the actual database name:
    ALTER DATABASE YourDatabase SET PARTNER TIMEOUT 10;
    This sets the timeout to 10 seconds, which is the maximum allowed. You can use a lower value like 5 if you prefer faster failover detection.
  4. Verify the change. Re-run the query from step 1 to confirm the mirroring_timeout is now 10 or less.
  5. Test the mirroring session. If the database is currently in a mirrored state, check its status with:
    SELECT db.name, db.mirroring_state_desc FROM sys.databases db WHERE db.is_mirroring_enabled = 1;
    It should show SYNCHRONIZED or SYNCHRONIZING (normal).

Common Mistakes

  • Setting the timeout to 0 or a negative number. The timeout must be between 1 and 10 seconds. Setting it to 0 disables the timeout (not allowed) and negative numbers are invalid.
  • Applying the change to the wrong database. Make sure you're altering the database that is actually mirrored, not the principal or mirror server's system databases.
  • Forgetting that the timeout applies to both partners. The timeout is a property of the database on both the principal and mirror. Changing it on one side automatically propagates to the other, but if you're in a manual failover scenario, you may need to set it on both.
  • Assuming the error only appears during setup. Error 1476 can also occur when you try to change the timeout to an invalid value on an existing mirrored database.

Tips

  • Use 10 seconds for most production environments. It's the maximum and provides a good balance between fast failover and network tolerance.
  • Lower the timeout for high-availability critical systems. If you need faster failover, consider 5 seconds, but be aware that transient network blips could trigger unnecessary failovers.
  • Monitor the timeout regularly. Use the query in step 1 as part of a routine health check.
  • Document the timeout setting. If you have multiple mirrored databases, keep a record of the timeout values for each.

Troubleshooting

If setting the timeout to 10 seconds doesn't resolve the issue, or you still see error 1476:

  • Check for syntax errors. Ensure the database name is spelled correctly and you're not missing the SET PARTNER clause.
  • Verify permissions. If you get a permission denied error, contact your SQL Server administrator.
  • Check if the database is actually in a mirroring session. If is_mirroring_enabled is 0, the timeout setting is irrelevant. You may need to configure mirroring first.
  • Look at the SQL Server error log. The error log may contain additional details about why the timeout value was rejected.
  • If you're trying to set a timeout during mirroring configuration, make sure you've already specified the partner server with SET PARTNER = 'TCP://...' before setting the timeout.

Frequently Asked Questions

What exactly does the mirroring timeout value do?

It defines how long a SQL Server instance waits for a response from its mirroring partner before considering the partner unavailable and initiating a failover (if automatic failover is configured).

Can I set the timeout to more than 10 seconds?

No, SQL Server enforces a maximum of 10 seconds. Error 1476 is thrown precisely when you try to exceed that.

What happens if I set the timeout too low?

If the timeout is too low (e.g., 1 second), network latency or a brief pause in the SQL Server service could cause a false failover, interrupting your application.

Does the timeout apply to both the principal and the mirror?

Yes, the timeout is a database property that is shared across the mirroring session. Changing it on one side updates the other automatically.

Can I change the timeout while mirroring is active?

Yes, you can run the ALTER DATABASE command while mirroring is active. The change takes effect immediately.

What if I don't want automatic failover?

If you don't have automatic failover configured (i.e., you're using high-safety mode without automatic failover), the timeout still controls how quickly the principal detects a mirror failure, but no automatic failover occurs.