| title | sp_addlogreader_agent (Transact-SQL) | Microsoft Docs | ||
|---|---|---|---|
| ms.custom | |||
| ms.date | 03/14/2017 | ||
| ms.prod | sql | ||
| ms.prod_service | database-engine | ||
| ms.reviewer | |||
| ms.technology | replication | ||
| ms.topic | language-reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| ms.assetid | d83096b9-96ee-4789-bde0-940d4765b9ed | ||
| author | mashamsft | ||
| ms.author | mathoma |
[!INCLUDEappliesto-ss-asdbmi-xxxx-xxx-md]
Adds a Log Reader agent for a given database. This stored procedure is executed at the Publisher on the publication database.
Important
When configuring a Publisher with a remote Distributor, the values supplied for all parameters, including job_login and job_password, are sent to the Distributor as plain text. You should encrypt the connection between the Publisher and its remote Distributor before executing this stored procedure. For more information, see Enable Encrypted Connections to the Database Engine (SQL Server Configuration Manager).
Transact-SQL Syntax Conventions
sp_addlogreader_agent [ @job_login = ] 'job_login'
, [ @job_password = ] 'job_password'
[ , [ @job_name = ] 'job_name' ]
[ , [ @publisher_security_mode = ] publisher_security_mode ]
[ , [ @publisher_login = ] 'publisher_login' ]
[ , [ @publisher_password = ] 'publisher_password' ]
[ , [ @publisher = ] 'publisher' ]
[ @job_login = ] 'job_login'
Is the login for the [!INCLUDEmsCoName] Windows account under which the agent runs. job_login is nvarchar(257), with a default value of NULL. This Windows account is always used for agent connections to the Distributor.
Note
For non- [!INCLUDEmsCoName][!INCLUDEssNoVersion] Publishers, this must be the same login specified in sp_adddistpublisher (Transact-SQL).
[ @job_password = ] 'job_password'
Is the password for the Windows account under which the agent runs. job_password is sysname, with a default value of NULL.
Important
Do not store authentication information in script files. For best security, login names and passwords should be supplied at runtime.
[ @job_name = ] 'job_name'
Is the name of an existing agent job. job_name is sysname, with a default value of NULL. This parameter is only specified when the agent is started using an existing job instead of a newly created job (the default).
[ @publisher_security_mode = ] publisher_security_mode
Is the security mode used by the agent when connecting to the Publisher. publisher_security_mode is smallint, with a default of 1. 0 specifies [!INCLUDEssNoVersion] Authentication, and 1 specifies Windows Authentication. A value of 0 must be specified for non- [!INCLUDEssNoVersion] Publishers.
[ @publisher_login = ] 'publisher_login'
Is the login used when connecting to the Publisher. publisher_login is sysname, with a default of NULL. publisher_login must be specified when publisher_security_mode is 0. If publisher_login is NULL and publisher_security_mode is 1, then the Windows account specified in job_login will be used when connecting to the Publisher.
[ @publisher_password = ] 'publisher_password'
Is the password used when connecting to the Publisher. publisher_password is sysname, with a default of NULL.
Important
Do not store authentication information in script files. For best security, login names and passwords should be supplied at runtime.
[ @publisher = ] 'publisher'
Is the name of the non- [!INCLUDEssNoVersion] Publisher. publisher is sysname, with a default of NULL.
Note
You should not specify this parameter for a [!INCLUDEssNoVersion] Publisher.
0 (success) or 1 (failure)
sp_addlogreader_agent is used in transactional replication.
You must execute sp_addlogreader_agent to add a Log Reader agent if you upgraded a database that was enabled for replication to this version of [!INCLUDEssNoVersion] before a publication was created that used the database.
Only members of the sysadmin fixed server role or the db_owner fixed database role can execute sp_addlogreader_agent.
[!code-sqlHowTo#sp_AddTranPub]
Create a Publication
sp_addpublication (Transact-SQL)
sp_changelogreader_agent (Transact-SQL)
Replication Stored Procedures (Transact-SQL)