Show TOC

sp_stop_rep_agentLocate this document in the navigation structure

Shuts down the RepAgent thread for the specified database.

sp_stop_rep_agent <dbname>[, 'nowait']

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


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.

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 
  • 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.


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