Database Mirroring (SQL Server Compact)

Replication and database mirroring (failover) support for merge replication between SQL Server 2008 and SQL Server Compact 3.5 is supported. For database mirroring, you must be running SQL Server services under a domain account. By default, the domain account is under the local system account.

Setting up SQL Server for Database Mirroring

To set up SQL Server for database mirroring, follow the instructions in the SQL Server 2008 Books Online topic Replication and Database Mirroring or on MSDN online.

Setting up Internet Information Services (IIS) Server

To set up IIS for database mirroring, see the following SQL Server Compact 3.5 Books Online topics:

Configuring the IIS Server Environment

Configuring the SQL Server Environment for Replication

SQL Server Compact 3.5 as the Client for Database Mirroring

The following scenarios are supported when you use SQL Server Compact 3.5 as the client for database mirroring.

Note

For descriptions of principal (P), mirror (M), or witness (W), see the SQL Server 2008 Books Online topic Replication and Database Mirroring or see MSDN online.

Test case description Initial sync Incremental sync

Synchronize with principal – Both are UP

Pass

Pass

Synchronize with principal – Mirror is DOWN

Pass

Pass

Failover - Principal went down, mirror became a principal, and the principal became a mirror.

Synchronize with old principal (now mirror) – Both are UP

Fail

Pass

Synchronize with mirror – principal is DOWN

Fail

Pass

Key points are as follows:

  1. After a merge subscription is created, SqlCeReplication.Publisher always remains the same, regardless of the failover. That is, SqlCeReplication.Publisher always points to the principal of merge subscription at creation time, even if the principal is now the mirror.
  2. Synchronization always occurs with the principal. If the principal is down, the failover of merge replication occurs automatically to the new principal.
  3. When there is a failover, you do not have to change subscription properties.
  4. SQL Server Compact 3.5 can synchronize with multiple SQL Server versions. SQL Server Compact 3.5 connects to SQL Server to find its version. After the version is determined, SQL Server Compact 3.5 identifies the version-specific replication client components in order to create the merge subscription. After the subscription is created, the publisher details are saved, and incremental sync does not require a direct connection.
  5. Mirror does not allow for a direct OLEDB connection.
  6. When there is a failover, you must specify either a new principal or the current principal as publisher when creating the subscription. If you specify the publisher as old principal (now mirror), regardless of whether it is UP or DOWN, the initial subscription fails. The reason for this failure is the previous points 4 and 5.