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 |
---|---|
|
See Create and Apply the Snapshot. |
|
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:
A schema snapshot is created, which contains the following items:
- Replication scripts.
- Schema of the published objects.
- (But no data.)
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:
Specify an alternate snapshot folder location instead of, or in addition, to the default snapshot folder location. For more information, see Modify snapshot options.
Compress snapshots for storage on removable media or for transfer over a slow network. For more information, see Compressed Snapshots.
Execute Transact-SQL scripts before or after the snapshot is applied. For more information, see Execute Scripts Before and After the Snapshot Is Applied.
Transfer snapshot files using File Transfer Protocol (FTP). For more information, see Transfer Snapshots Through FTP.