Replication Agents (Troubleshooting)
Replication provides a number of features that can be used if you need to troubleshoot replication agent processing:
A set of agent parameters that can aid troubleshooting. These parameters are described in this topic.
Access to agent history and output in Replication Monitor. For more information, see Replication Monitor (Troubleshooting).
A set of predefined alerts that can be used to notify administrators about a number of conditions, including agent failures and performance issues. For more information, see Setting Thresholds and Warnings in Replication Monitor and Using Alerts for Replication Agent Events.
If you are using Web Synchronization, you can start Replmerg.exe and pass the -T 106 option to use trace flag 106. This enables you to see the messages that are sent to and from the Publisher. By adding the trace flag to the Replmerg.exe agent command line, the agent writes the client's input messages to a file that is named ExchangeID(guid).IN.XML, and writes the output messages to a file that is named ExchangeID(guid).OUT.XML. (In these file names, guid is the GUID of the Exchange Server session.) These files are created in the directory from which Replmerg.exe was invoked. For security, you should delete these files after you are finished.
All replication agents support the following parameters. We recommend using these parameters during troubleshooting, and then setting them to appropriate values after troubleshooting is completed. For example, the -Output parameter should only be used during troubleshooting because it can affect performance.
The amount of history logged during an agent operation. Specifying a higher value for this parameter can be useful when troubleshooting.
The amount and type of information output during agent processing. The agent output can be written to a file, which is specified using the -Output parameter.
The path of the agent output file. If the file name is not provided, the output is sent to the console. When troubleshooting, we recommend that you use a higher value for -OutputVerboseLevel and have the output written to a file.
The number of seconds before an agent query times out. Specifying a higher value for this parameter can be useful, especially when troubleshooting performance issues in which queries are running slowly.
The number of seconds before an agent login attempt times out. Specifying a higher value for this parameter can be useful, especially when troubleshooting connectivity issues.
The Distribution Agent supports two additional parameters.
A list of errors that should be skipped during the application of changes at the Subscriber. For more information, see Skipping Errors in Transactional Replication.
The path and file name of the error file generated by the Distribution Agent. This file is generated at any point where failure occurred while applying replication transactions at the Subscriber; errors that occur at the Publisher or Distributor are not logged in this file. This file contains the failed replication transactions and associated error messages. When not specified, the error file is generated in the current directory of the Distribution Agent. The error file name is distrib.err.
Agent parameters can be specified in the following ways:
In a replication agent profile. For more information, see How to: Work with Replication Agent Profiles (SQL Server Management Studio) and How to: Work with Replication Agent Profiles (Replication Transact-SQL Programming).
In the SQL Server Agent job step that runs the replication agent. For more information, see How to: View and Modify Replication Agent Command Prompt Parameters (SQL Server Management Studio).
Directly on the command line or in a batch file. For more information, see Replication Agent Executables Concepts.
For a complete list of parameters for each agent, see the following topics: