SQL Server Database Engine
Only one Log Reader Agent or log-related procedure (sp_repldone, sp_replcmds, and sp_replshowcmds) can connect to a database at a time. If you executed a log-related procedure, drop the connection over which the procedure was executed or execute sp_replflush over that connection before starting the Log Reader Agent or executing another log-related procedure.
More than one current connection is trying to execute any of the following: sp_repldone, sp_replcmds, or sp_replshowcmds. The stored procedures sp_repldone (Transact-SQL) and sp_replcmds (Transact-SQL) are stored procedures used by the Log Reader Agent to locate and update information about replicated transactions in a published database. The stored procedure sp_replshowcmds (Transact-SQL) is used to troubleshoot certain types of issues with transactional replication.
This error is raised in the following circumstances:
If the Log Reader Agent for a published database is running and a second Log Reader Agent attempts to run against the same database, the error is raised for the second agent and appears in the agent history.
In a situation where it appears there are multiple agents, it is possible that one of them is the result of an orphaned process.
If the Log Reader Agent for a published database is started and a user executes sp_repldone, sp_replcmds, or sp_replshowcmds against the same database, the error is raised in the application where the stored procedure was executed (such as sqlcmd).
If no Log Reader Agent is running for a published database and a user executes sp_repldone, sp_replcmds, or sp_replshowcmds and then does not close the connection over which the procedure was executed, the error is raised when the Log Reader Agent attempts to connect to the database.
The following steps can help you to troubleshoot the problem. If any step allows the Log Reader Agent to start without errors, there is no need to complete the remaining steps.
Check the history of the Log Reader agent for any other errors that could be contributing to this error. For information about viewing agent status and error details in Replication Monitor, see View Information and Perform Tasks for the Agents Associated With a Publication (Replication Monitor).
Check the output of sp_who (Transact-SQL) for specific process identification numbers (SPIDs) that are connected to the published database. Close any connections that might have run sp_repldone, sp_replcmds, or sp_replshowcmds.
Restart the Log Reader Agent. For more information, see Start and Stop a Replication Agent (SQL Server Management Studio).
Restart the SQL Server Agent service (bring it offline or online in a cluster) on the Distributor. If there is possibility that a scheduled job could have executed sp_repldone, sp_replcmds, or sp_replshowcmds from any other SQL Server instance, restart the SQL Server Agent for those instances as well. For more information, see Start, Stop, or Pause the SQL Server Agent Service.
Execute sp_replflush (Transact-SQL) at the Publisher on the publication database, and then restart the Log Reader Agent.
If the error continues to occur, increase the logging of the agent and specify an output file for the log. Depending on the context of the error, this could provide the steps leading up to the error and/or additional error messages.