Agents and Monitors

SQL Replication

Replication

Agents and Monitors

Agents used with Microsoft® SQL Server™ 2000 replication carry out the tasks associated with copying and distributing data. SQL Server 2000 replication uses SQL Server Agent as well as agents that are specific to replication.

SQL Server Agent

SQL Server Agent hosts and schedules the agents used in replication, and provides an easy way to run replication agents. SQL Server Agent also controls and monitors several other operations outside of replication, including monitoring the SQL Server Agent service, maintaining error logs, running jobs, and starting other processes.

Snapshot Agent

The Snapshot Agent is used with all types of replication. It prepares schema and initial data files of published tables and stored procedures, stores the snapshot files, and records information about synchronization in the distribution database. The Snapshot Agent typically runs under SQL Server Agent at the Distributor and can be administered using SQL Server Enterprise Manager.

Log Reader Agent

The Log Reader Agent is used with transactional replication. It 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.

Distribution Agent

The Distribution Agent is used with snapshot replication and transactional replication. It moves the snapshot jobs and transactions held in the distribution database to Subscribers. The Distribution Agent typically runs at either the Distributor for push subscriptions or at the Subscriber for pull subscriptions.

Merge Agent

The Merge Agent is used with merge replication. It applies the initial snapshot to the Subscriber, and moves and reconciles incremental data changes that occur. Each merge subscription has its own Merge Agent that connects to both the Publisher and the Subscriber and updates both. The Merge Agent typically runs at either the Distributor for push subscriptions or the Subscriber for pull subscriptions. The Merge Agent typically uploads changes from the Subscriber to the Publisher and then downloads changes from the Publisher to the Subscriber during a typical bidirectional merge. Changes can also be moved in one direction by configuring the exchange type of the agent.

Queue Reader Agent

The Queue Reader Agent is used with snapshot replication or transactional replication with the queued updating option, or if the immediate updating with queued updating as a failover option is enabled.

The Queue Reader Agent is a multithreaded agent that runs on the Distributor. It is responsible for taking messages from a queue and applying them to the appropriate publication.

Unlike the Distribution Agent and the Merge Agent, only one instance of the Queue Reader Agent exists to service all Publishers and publications for a given Distributor.

Miscellaneous Agents

Clean up agents listed under the Miscellaneous Agents folder in Replication Monitor complete scheduled and on-demand maintenance of replication.

Clean up agent Description Default schedule
Agent History Clean Up: Distribution Removes replication agent history from the distribution database. Runs every 10 minutes
Distribution Clean Up: Distribution Removes replicated transactions from the distribution database. Runs every 10 minutes
Expired Subscription Clean Up Detects and removes expired subscriptions from publication databases. Runs every day at 1:00 A.M.
Reinitialize Subscriptions Having Data Validation Failures Reinitializes all subscriptions that have data validation failures. No default schedule (not enabled by default).
Replication Agents Checkup Detects replication agents that are not actively logging history. Runs every 10 minutes
Replication Monitor

Through Replication Monitor in SQL Server Enterprise Manager, you can view and manage replication agents responsible for various replication tasks. For example, you can set up transactional replication so that the log on the Publisher is read continuously, transactions are distributed to Subscribers every ten minutes (although this is often also continuously), and initial snapshots are generated every night at midnight. You can also execute replication agents on demand.

Replication Monitor provides a way to set alerts on replication events. When the event occurs, Replication Monitor responds automatically, either by executing a task that you have defined or by sending an e-mail or a pager message to a specified individual.

See Also

Administering and Monitoring Replication

Replication Agents

Types of Replication