Share via


Initializing a Merge Subscription Without a Snapshot

Note

This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

By default, a subscription to a merge publication is initialized with a snapshot, which is generated by the Snapshot Agent and applied by the Merge Agent. In some scenarios, you can initialize a subscription using another method, such as a backup. Merge replication supports initializing subscriptions without a snapshot for both filtered and unfiltered publications. The option is more commonly used with unfiltered publications and those that use static filters. Publications that use parameterized filters are typically initialized with a snapshot for a Subscriber's partition. For more information, see Snapshots for Merge Publications with Parameterized Filters.

When possible, initialize subscriptions with a snapshot. We recommend against initializing a subscription without a snapshot, especially under the following conditions:

  • When using column-level tracking, vertical filtering, or making schema changes at the Publisher. This can result in non-convergence when initializing a subscription without a snapshot.

  • When using Web synchronization, snapshot files are replicated to the Subscriber but are not used.

  • When you must reinitialize the subscription.

  • When you need the performance benefits provide by using precomputed partitions.

To initialize a merge subscription from a backup or using another method, use the following steps:

  1. Add a uniqueidentifier column with the rowguid and not null column attributes to the tables that will be used in merge replication.

  2. Perform a backup of the database that you will use to initialize the subscriber.

  3. Create a publication and generate the snapshot for the publication. Although the schema and data from published tables in the snapshot will not be used, the snapshot is still required because it includes system objects and metadata required by replication. These objects and metadata are copied to the Subscriber during the initial synchronization.

  4. Restore the backup at the Subscriber or copy data using another method. If you restore a backup, do not specify the KEEP_REPLICATION option. This option is designed to maintain replication settings during restore; the backup came from the Publisher, so you want to remove the Publisher settings from the database. The restored database will have the necessary Subscriber settings after the initial synchronization.

  5. Create a subscription, specifying that the subscription will be initialized manually.

    Note

    If a subscription is initialized without using a snapshot, the account under which the SQL Server service runs at the Publisher must have write permissions on the snapshot folder at the Distributor. For more information about permissions, see Replication Agent Security Model.

    For more information, see:

  6. Perform an initial synchronization with the Merge Agent to copy the objects and metadata required by replication. The Subscriber is now synchronized and ready to accept incremental changes from the Publisher.