Replication Log Reader Agent
The Replication Log Reader Agent is an executable that monitors the transaction log of each database configured for transactional replication and copies the transactions marked for replication from the transaction log into the distribution database.
Parameters can be specified in any order. When optional parameters are not specified, predefined values based on the default agent profile are used.
[-PublisherFailoverPartner server_name[\instance_name] ]
Displays usage information.
Is the name of the Publisher. Specify server_name for the default instance of Microsoft SQL Server on that server. Specify server_name\instance_name for a named instance of SQL Server on that server.
Is the name of the Publisher database.
Specifies whether the agent tries to poll replicated transactions continually. If specified, the agent polls replicated transactions from the source at polling intervals even if there are no transactions pending.
Is the path of the agent definition file. An agent definition file contains command-line arguments for the agent. The content of the file is parsed as an executable file. Use double quotation marks (") to specify argument values that contain arbitrary characters.
Is the Distributor name. Specify server_name for the default instance of SQL Server on that server. Specify server_name\instance_name for a named instance of SQL Server on that server.
Is the Distributor login name.
Is the Distributor password.
-DistributorSecurityMode [ 0| 1]
Specifies the security mode of the Distributor. A value of 0 indicates SQL Server Authentication Mode (default), and a value of 1 indicates Microsoft Windows Authentication Mode.
-EncryptionLevel [ 0 | 1 | 2 ]
Is the level of Transport Layer Security (TLS), previously known as Secure Sockets Layer (SSL), encryption that is used by the Log Reader Agent when making connections.
|Specifies that TLS is not used.
|Specifies that TLS is used, but the agent does not verify that the TLS/SSL server certificate is signed by a trusted issuer.
|Specifies that TLS is used, and that the certificate is verified.
A valid TLS/SSL certificate is defined with a fully qualified domain name of the SQL Server. In order for the agent to connect successfully when setting -EncryptionLevel to 2, create an alias on the local SQL Server. The 'Alias Name' parameter should be the server name and the 'Server' parameter should be set to the fully qualified name of the SQL Server.
For more information, see View and modify replication security settings.
Specifies the path and file name for the extended events XML configuration file. The extended events configuration file allows you to configure sessions and enable events for tracking.
Internal use only.
-HistoryVerboseLevel [ 0| 1| 2]
Specifies the amount of history logged during a log reader operation. You can minimize the performance effect of history logging by selecting 1.
|Default. Always update a previous history message of the same status (startup, progress, success, and so on). If no previous record with the same status exists, insert a new record.
|Insert new history records unless the record is for such things as idle messages or long-running job messages, in which case update the previous records.
Is the number of seconds before the history thread checks if any of the existing connections is waiting for a response from the server. This value can be decreased to avoid having the checkup agent mark the Log Reader Agent as suspect when executing a long-running batch. The default is 300 seconds.
Is the number of seconds before the login times out. The default is 15 seconds.
Internal use only.
Specifies the maximum number of statements grouped into a transaction as the Log Reader writes commands to the distribution database. Using this parameter allows the Log Reader Agent and Distribution Agent to divide large transactions (consisting of many commands) at the Publisher into several smaller transactions when applied at the Subscriber. Specifying this parameter can reduce contention at the Distributor and reduce latency between the Publisher and Subscriber. Because the original transaction is applied in smaller units, the Subscriber can access rows of a large logical Publisher transaction prior to the end of the original transaction, breaking strict transactional atomicity. The default is 0, which preserves the transaction boundaries of the Publisher.
This parameter is ignored for non- SQL Server publications. For more information, see the section "Configuring the Transaction Set Job" in Performance Tuning for Oracle Publishers.
MaxCmdsInTran was not designed to be always turned on. It exists to work around cases where someone accidentally performed a large number of DML operations in a single transaction (causing a delay in the distribution of commands until the entire transaction is in the distribution database, locks being held, etc.). If you routinely fall into this situation,review your applications and find ways to reduce the transaction size.
MaxCmdsInTran is not supported if the given publication database is enabled for both Change Data Capture and replication. Using MaxCmdsInTran in this configuration may lead to data loss in CDC change tables. It may also cause PK errors if the MaxCmdsInTran parameter is added and removed while replicating a large Transaction.
Is the time interval used for history logging. A history event is logged when the MessageInterval value is reached after the last history event is logged.
If there is no replicated transaction available at the source, the agent reports a no-transaction message to the Distributor. This option specifies how long the agent waits before reporting another no-transaction message. Agents always report a no-transaction message when they detect that there are no transactions available at the source after previously processing replicated transactions. The default is 60 seconds.
-MultiSubnetFailover [0|1] Specifies whether the MultiSubnetFailover property is enabled or not. If your application is connecting to an Always On availability group (AG) on different subnets, setting MultiSubnetFailover to 1 (true) provides faster detection of and connection to the (currently) active server.
When you configure a transactional publication on an AG, the Log Reader Agent creates a dynamic linked server for the listener to verify the metadata. Starting with SQL Server 2022 CU10, there's a change in the configuration of the dynamic linked server. For more information, see KB5031778.
Applies to: SQL Server (Starting with SQL Server 2019 (15.x)).
Is the path of the agent output file. If the file name is not provided, the output is sent to the console. If the specified file name exists, the output is appended to the file.
-OutputVerboseLevel [ 0| 1| 2 | 3 | 4 ]
Specifies whether the output should be verbose.
|Only error messages are printed.
|All agent progress report messages are printed.
|All error messages and agent progress report messages are printed.
|The first 100 bytes of each replicated command are printed.
|All replicated commands are printed.
Values 2-4 are useful when debugging.
Is the packet size, in bytes. The default is 4096 (bytes).
Is how often, in seconds, the log is queried for replicated transactions. The default is 5 seconds.
Specifies an agent profile to use for agent parameters. If ProfileName is NULL, the agent profile is disabled. If ProfileName is not specified, the default profile for the agent type is used. For information, see Replication Agent Profiles.
Specifies the failover partner instance of SQL Server participating in a database mirroring session with the publication database. For more information, see Database Mirroring and Replication (SQL Server).
-PublisherSecurityMode [ 0| 1]
Specifies the security mode of the Publisher. A value of 0 indicates SQL Server Authentication (default), and a value of 1 indicates Windows Authentication Mode.
Is the Publisher login name.
Is the Publisher password.
Is the number of seconds before the query times out. The default is 1800 seconds.
Is the maximum number of transactions read out of the transaction log of the publishing database per processing cycle, with a default of 500, and max of 10000. The agent will continue to read transactions in batches until all transactions are read from the log. This parameter is not supported for Oracle Publishers.
Is the number of replication commands to be read from the transaction log before being issued to the Subscriber by the Distribution Agent. The default is 0. If this parameter is not specified, the Log Reader Agent will read to the end of the log or to the number specified in -ReadBatchSize (number of transactions).
Specifies that the Log Reader Agent continue to run when it encounters errors in column data published from a non-SQL Server Publisher. By default, such errors cause the Log Reader Agent to fail. When you use -RecoverFromDataErrors, erroneous column data is replicated either as NULL or an appropriate nonnull value, and warning messages are logged to the MSlogreader_history table. This parameter is only supported for Oracle Publishers.
If you installed SQL Server Agent to run under a local system account instead of under a domain user account (the default), the service can access only the local computer. If the Log Reader Agent that runs under SQL Server Agent is configured to use Windows Authentication Mode when it logs in to SQL Server, the Log Reader Agent fails. The default setting is SQL Server Authentication. For information about changing security accounts, see View and Modify Replication Security Settings.
To start the Log Reader Agent, execute logread.exe from the command prompt. For information, see Replication Agent Executables Concepts.
|Added the -ExtendedEventConfigFile parameter.
|Added the -MultiSubnetFailover parameter.