sp_start_rep_agent

Starts a RepAgent thread for the specified database.

Syntax

sp_start_rep_agent dbname[, {'recovery' | 'recovery_foreground’ | 'resync' | 'resync purge' 
																		| 'resync init'} [, 'connect_dataserver', 
              'connect_database'[, 'repserver_name', repserver_username', 
             'repserver_password']]]

Parameters

Examples

Usage

  • Use sp_start_rep_agent with RepAgent-enabled databases.

  • Use the sp_start_rep_agent command to start up RepAgent after you have enabled it with sp_config_rep_agent. Once you have started RepAgent with sp_start_rep_agent, it will automatically start up after the data server is recovered during server startup.

  • Autostart is disabled after you have used sp_stop_rep_agent to shut down RepAgent. Reenable it using sp_start_rep_agent.

  • For offline recovery, archived transaction logs may be dumped to a temporary recovery database. You can then transfer records in the transaction log of the temporary recovery database to the replicate database. Execute sp_start_rep_agent with either recovery or recovery_foreground, using the temporary data server and database names, to scan the temporary transaction log.

    In recovery, when the RepAgent has completed scanning the transaction log, RepAgent shuts down. After the next transaction dump has been loaded, restart the RepAgent by executing sp_start_rep_agent with the options specified earlier.

Permissions

sp_start_rep_agent requires “sa” or “dbo” permission or replication_role.

Related reference
sp_help_rep_agent
sp_stop_rep_agent