Starts a RepAgent thread for the specified database.
sp_start_rep_agent dbname[, 'for_recovery'[, 'connect_dataserver', 'connect_database'[, 'repserver_name', repserver_username', 'repserver_password']]]
The name of the database for which you want to start a RepAgent.
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.
The name of the data server used to recover offline logs.
The name of the database used to recover offline logs.
The name of the Replication Server to which RepAgent connects.
The user name that RepAgent uses to connect to Replication Server.
The password that RepAgent uses to connect to Replication Server.
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
Starts RepAgent in recovery mode for the pdb2 database connected to the svr2 data server.
sp_start_rep_agent pubs2 for_recovery, svr2, pdb2
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 dataserver is recovered during server startup.
Autostart is disabled after you have used sp_stop_rep_agent to shut down Rep Agent. Re-enable 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 in recovery mode, 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.
sp_start_rep_agent requires sa or dbo permission or Replication role.