Administering Replication Agents

Replication agents carry out many of the tasks associated with replication, including creating copies of schema and data, detecting updates at the Publisher or Subscriber, and propagating changes between servers. By default, replication agents run under Microsoft SQL Server Agent job steps. The agents are simply executables, so they can also be called directly from the command line and from batch scripts. Each replication agent supports a set of run-time parameters used to control how it runs; these parameters are specified in an agent profile or on the command line.

Important

By default, the SQL Server Agent service is disabled when SQL Server 2005 is installed unless you explicitly choose to autostart the service during installation. For more information about starting the SQL Server Agent service, see Starting SQL Server Agent.

Replication agent files are located under X:\Program Files\Microsoft SQL Server\90\COM. The following table lists the replication executable names and file names. Click the link for an agent to view its parameter reference.

Agent Executable File Name

Replication Snapshot Agent

snapshot.exe

Replication Distribution Agent

distrib.exe

Replication Log Reader Agent

logread.exe

Replication Queue Reader Agent

qrdrsvc.exe

Replication Merge Agent

replmerg.exe

In addition to replication agents, replication has a number of jobs that perform scheduled and on-demand maintenance.

To run agents and maintenance jobs

Agent Profiles

When replication is configured, a set of agent profiles is installed on the Distributor. An agent profile contains a set of parameters that are used each time an agent runs: each agent logs in to the Distributor during its startup process and queries for the parameters in its profile. Replication provides a default profile for each agent and additional predefined profiles for the Log Reader Agent, Distribution Agent, and Merge Agent. In addition to the profiles provided, you can create profiles suited to your application requirements. For more information, see Replication Agent Profiles.

For information about specifying command line parameters directly, see Programming Replication Agent Executables and How to: View and Modify Replication Agent Command Prompt Parameters (SQL Server Management Studio).

Monitoring Replication Agents

Replication Monitor allows you to view information and perform tasks associated with each replication agent. The following list includes each agent, the tabs in the Replication Monitor on which it can be found, and a link to a topic that explains how to access these tabs:

Independent and Shared Agents

An independent agent is an agent that services one subscription. A shared agent services multiple subscriptions; if multiple subscriptions using the same shared agent need to synchronize, by default they wait in a queue, and the shared agent services them one at a time. Latency is reduced when using independent agents because the agent is ready whenever the subscription needs to be synchronized. Merge replication always uses independent agents, and transactional replication uses independent agents by default for publications created in the New Publication Wizard (in previous versions of SQL Server, transactional replication used shared agents by default).

Replication Maintenance Jobs

Replication uses the following jobs to perform scheduled and on-demand maintenance.

Clean up job Description Default schedule

Agent History Clean Up: Distribution

Removes replication agent history from the distribution database.

Runs every ten minutes

Distribution Clean Up: Distribution

Removes replicated transactions from the distribution database. Deactivates subscriptions that have not been synchronized within the maximum distribution retention period. For more information, see Subscription Expiration and Deactivation.

Runs every ten minutes

Expired Subscription Clean Up

Detects and removes expired subscriptions from publication databases. For more information, see Subscription Expiration and Deactivation.

Runs every day at 1:00 A.M.

Reinitialize Subscriptions Having Data Validation Failures

Detects all subscriptions that have data validation failures and marks them for reinitialization. The next time the Merge Agent or Distribution Agent runs, a new snapshot will be applied at the Subscribers. For more information on validation, see Validating Replicated Data.

No default schedule (not enabled by default).

Replication Agents Checkup

Detects replication agents that are not actively logging history. It writes to the Microsoft Windows event log if a job step fails.

Runs every ten minutes.

Replication monitoring refresher for distribution

Refreshes cached queries used by Replication Monitor. For more information, see Caching, Refresh, and Replication Monitor Performance.

Runs continuously.

See Also

Concepts

Monitoring Replication with Replication Monitor

Other Resources

Administering Replication

Help and Information

Getting SQL Server 2005 Assistance