Starts a RepAgent thread for the specified database.
sp_start_rep_agent dbname[, {'recovery' | 'recovery_foreground’ | 'resync' | 'resync purge' | 'resync init'} [, 'connect_dataserver', 'connect_database'[, 'repserver_name', repserver_username', 'repserver_password']]]
You can also specify the Replication Server name, user name, and password in recovery mode. Specify these parameters to override sysattributes settings.
Sends the resync database marker without any option when there is no change to the truncation point and the expectation is that the RepAgent should continue processing the transaction log from the last point that it processed.
Sends the resync database marker with the purge option to instruct Replication Server to purge all open transactions from the inbound queue, and reset duplicates detection, before receiving any new inbound transactions.
Sends the resync database marker with the init option to instruct Replication Server to purge all open transactions from the inbound queue, reset duplicate detection, and suspend the outbound DSI.
sp_start_rep_agent pubs2
sp_start_rep_agent pubs2 for_recovery, svr2, pdb2
sp_start_rep_agent db2, recovery_foreground, ds, db1
RepAgent(5). Starting recovery, processing log records between (1018, 0) and (2355, 2). RepAgent(5). Processed 1000 log records. RepAgent(5). Processed 2000 log records. RepAgent(5). Processed 3000 log records. RepAgent(5). Processed 4000 log records. RepAgent(5). Processed 5000 log records. RepAgent(5). Processed 6000 log records. RepAgent(5). Processed 7000 log records. RepAgent(5). Processed 8000 log records. RepAgent(5). Processed 9000 log records. RepAgent(5). Processed 10000 log records. RepAgent(5). Processed 11000 log records. RepAgent(5). Processed 12000 log records. RepAgent(5). Processed 13000 log records. RepAgent(5). Processed 14000 log records. RepAgent(5). Processed 15000 log records. RepAgent(5). Processed 16000 log records. RepAgent(5). Processed 17000 log records. RepAgent(5). Processed 18000 log records. RepAgent(5). Processed 19000 log records. RepAgent(5). Processed 20000 log records. RepAgent(5). Processed 20084 log records, recovery complete. Replication Agent thread is started for database 'db2'. (return status = 0)
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.