Initialize a Subscription with a Snapshot for a New Publication

Applies to: SQL Server Azure SQL Managed Instance

This article describes the processes that occur when a replication publication is initialized. An initial snapshot is applied to the Subscribers.

Snapshot for a new publication

By default, a snapshot is captured after a publication is created. The snapshot is copied to the snapshot folder. This default behavior occurs for merge publications that are created by using the New Publication Wizard.

Snapshot is applied to Subscriber

The new snapshot is applied to the Subscriber by an agent. The applying occurs during the initial synchronization of the subscription. Which agent does the applying depends on the type of publication:

  • For transactional and snapshot publications:

    • The Distribution Agent.
  • For merge publications:

    • The Merge Agent.

Type of publication

The following table displays the contents of the snapshot, for each type of publication.

 

Publication type that the snapshot is for Contents of the snapshot
  • Snapshot publication
  • Transactional publication
  • Merge publication that doesn't use parameterized filters
  • Schema
  • Data, in files for the bulk copy program (BCP)
  • Constraints
  • Extended properties
  • Indexes
  • Triggers
  • System tables needed for replication

See Create and Apply the Snapshot.
  • Merge publication that does use parameterized filters
  • Schema snapshot (replication scripts, published objects, but no data)
  • Data that belongs to the subscription's partition

See Snapshots for Merge Publications with Parameterized Filters.

Two-part process with merge publication that uses parameterized filters

For a merge publication that uses parameterized filters, the snapshot is created by using the following two-part process:

  1. A schema snapshot is created, which contains the following items:

    • Replication scripts.
    • Schema of the published objects.
    • (But no data.)
  2. Each subscription is then initialized with a snapshot. The snapshot includes the following items:

    • Scripts and schema, copied from the schema snapshot.
    • Data that belongs to the subscription's partition.

Type of replication

The file types contained in the snapshot depend on the type of replication, and on the articles in your publication.

 

Type of Replication Common Snapshot Files
Snapshot Replication, or
Transactional Replication
• Schema (.sch)
• Data (.bcp)
• Constraints and indexes (.dri)
• Compressed snapshot files (.cab)
• Triggers (.tag), only to update a Subscriber

• Constraints (.idx).
Merge Replication • Schema (.sch)
• Data (.bcp)
• Constraints and indexes (.dri)
• Compressed snapshot files (.cab)
• Triggers (.trg)

• System table data (.sys)
• Conflict tables (.cft).

Snapshot folder

The files are transferred by being copied to the default snapshot folder, or to the alternate folder for snapshots.

The snapshot folder is specified when the Distributor is configured. The alternate folder is specified when the publication is created.

Resume transfer after interruption

Transfer of files to a snapshot folder automatically resumes if the transfer is interrupted by an unreliable connection.

For efficiency, the resumption does not resend any files that were already fully transferred before the interruption.

Snapshot Options

There are several options available when initializing a subscription with a snapshot. You can: