Replication Agents

In addition to the basic components, your replication design may have two or more replication agents:

The Snapshot Agent prepares schema and initial data files of published tables and stored procedures, stores the snapshot on the Distributor, and records information about the synchronization status in the distribution database. Each publication has its own Snapshot Agent that runs on the Distributor and connects to the Publisher. The Snapshot Agent is typically run under SQL Server Agent and can be administered directly using SQL Server Enterprise Manager.

The Log Reader Agent moves transactions marked for replication from the transaction log on the Publisher to the distribution database. Each database published using transactional replication has its own Log Reader Agent that runs on the Distributor and connects to the Publisher.

The Distribution Agent moves the transactions and snapshot jobs held in distribution database tables to Subscribers. Transactional and snapshot publications that are set up for immediate synchronization when a new push subscription is created each have their own Distribution Agent that runs on the Distributor and connects to the Subscriber. Transactional and snapshot publications not set up for immediate synchronization share a Distribution Agent across the Publisher/Subscriber pair that runs on the Distributor and connects to the Subscriber. Pull subscriptions to either snapshot or transactional publications have Distribution Agents that run on the Subscriber instead of the Distributor. Merge publications do not have a Distribution Agent. The Distribution Agent typically runs under SQL Server Agent and can be administered directly using SQL Server Enterprise Manager.

The Merge Agent moves and reconciles incremental data changes that occurred after the initial snapshot was created. Each merge publication has its own Merge Agent that connects to both the Publisher and the Subscriber and updates both. In a full merge, the agent first uploads all changes from the Subscriber where the generation is 0 or is greater than the last generation sent to the Publisher. The agent gathers the rows, and those rows without conflicts are applied to the publishing database. Those rows with conflicts are handled by the conflict resolver associated with the article in the publication definition. All changes are applied using stored procedures derived from the Publisher tables at the time snapshot is generated or first applied. Finally, the agent reverses the process by downloading any changes from the Publisher to the Subscriber and applying the changes to the subscribing database. Push subscriptions to merge publications have Merge Agents that run on the Publisher, while pull subscriptions to merge publications have Merge Agents that run on the Subscriber. Snapshot and transactional publications do not have Merge Agents.

See Also
Snapshot Replication Transactional Replication
Merge Replication Monitoring Replication Agents

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.