SQL failover in database mirroring environment


Description

Sitecore CMS supports exception-free SQL database failover scenarios starting with CMS version 6.6 and later.

In earlier CMS versions, when you access a Sitecore application, the System.Data.SqlClient.SqlException exception may appear when you run mirrored SQL setup for the Sitecore database when SQL failover scenario occurs.

The issue is related to a database mirroring environment with the witness server configured for automatic SQL failover. Exception-free failover is not supported by Microsoft when you use standard API to access SQL databases, and, therefore, Sitecore raises an error when you access the database after the failover scenario.

More information about this can be found at http://msdn.microsoft.com/en-us/library/aa342332(SQL.90).aspx

Solution

Repeat the operation that causes the error. Only the first request to the SQL database after the failover is expected to fail.

Also, disabling connection pooling in an SQL database connection string may cause the errors not to occur in some scenarios, while this may negatively affect database access performance.