sp_start_rep_agent

Description

Starts a RepAgent thread for the specified database.

Syntax

sp_start_rep_agent dbname[, 'recovery'[, 'connect_dataserver', 
	'connect_database'[, 'repserver_name', repserver_username', 
	'repserver_password']]]

Parameters

dbname

The name of the database for which you want to start a RepAgent.

recovery

Starts the RepAgent in recovery mode, which is used to initiate recovery actions. Recovery mode is used to rebuild queues when queues are lost.

You can also specify the Replication Server name, user name, and password in recovery mode. Specify these parameters to override sysattributes settings.

connect_dataserver

The name of the data server used to recover offline logs.

connect_database

The name of the database used to recover offline logs.

repserver_name

The name of the Replication Server to which RepAgent connects.

repserver_user_name

The user name that RepAgent uses to connect to Replication Server.

repserver_password

The password that RepAgent uses to connect to Replication Server.

Examples

Example 1

Starts an integrated RepAgent for the pubs2 database. RepAgent connects to the Replication Server specified in sp_config_rep_agent. It starts scanning the transaction log and sends formatted LTL commands to Replication Server.

sp_start_rep_agent pubs2 

Example 2

Starts RepAgent in recovery mode for the pdb2 database connected to the svr2 data server.

sp_start_rep_agent pubs2 for_recovery, svr2, pdb2

Usage

Permissions

sp_start_rep_agent requires “sa” or “dbo” permission or replication role.

See also

sp_help_rep_agent, sp_help_rep_agent, sp_stop_rep_agent