Show TOC

sp_stop_rep_agentLocate this document in the navigation structure

Shuts down the RepAgent thread for the specified database.

Syntax
sp_stop_rep_agent <dbname>[, 'nowait']
Parameters
dbname

The name of the database for which you want to shut down the RepAgent.

nowait

Shuts down the RepAgent immediately, without waiting for executing operations to complete.

The default shuts down RepAgent gracefully at the end of the current batch.

Examples
Example 1

Shuts down an integrated RepAgent for the <pubs2> database. The default shutdown option allows RepAgent to finish processing the current batch.

sp_stop_rep_agent pubs2 
Usage
  • Use sp_stop_rep_agent with RepAgent-enabled databases.

  • Once you have used sp_stop_rep_agent to shut down RepAgent, it does not automatically start up when the database comes online during server startup. To re-enable automatic startup, execute the sp_start_rep_agent procedure.

  • sp_stop_rep_agent is asynchronous and may take some time to execute. Use sp_who to check the status of the RepAgent.

Permissions

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