Starts a RepAgent thread for the specified database.
sp_start_rep_agent dbname[, {'recovery' | 'recovery_foreground’} [, '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.
recovery_foreground has the same function as recovery. However, it displays the recovery progress information on screen instead of in the Adaptive Server error log. The recovery is complete once the recovery progress information display ends and the command prompt displays.
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
Configures RepAgent to print the recovery of database db2 to the client:
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 dataserver 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.
sp_start_rep_agent requires “sa” or “dbo” permission or replication_role.