Error message in Merge replication "Call sp_MSensure_single_instance"

Gao Peng 26 Reputation points
2022-12-27T03:04:53.163+00:00

In replication monitor, I read an error message from a merge replication
"
Command attempted:
{call sp_MSensure_single_instance (N'IZT4N73LFYS1BMZ\FLAG2-flagdata-Flag Data Tables-WIN-5PNEMH7B8TU-642', 4)}

Error messages:
The merge process could not connect to the Publisher 'IZT4N73LFYS1BMZ\FLAG2016:flagdata'. Check to ensure that the server is running. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147199368)
Get help: http://help/MSSQL_REPL-2147199368
Another merge agent for the subscription or subscriptions is running, or the server is working on a previous request by the same agent. (Source: MSSQLServer, Error number: 21036)
Get help: http://help/21036
"

Then I check the job list in Subscriber's SSMS/SQL Server Agent node, there is no duplicate job so presumably there should be any merge agent running.
And everytime before I start this job, I always stop it first.

Can anyone tell me how to launch an investigation on if there is a hidden subscription/merge agent job. I did delete subscriptions few times, that is real. I should have removed those agent jobs as well.

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories


3 answers

Sort by: Newest
  1. Neil 0 Reputation points
    2026-11-11T18:43:52.2133333+00:00

    Same issue...Merge replication...

    I fix the problem with killing the process associated with the erroring subscription, using sp_who & kill #. I start with the largest ID and working "down" (up the query result).

    I do not know what is causing this at the moment, & it's only happening for one publication.

    I'm going to investigate whether it might have something to do with an application initiating replication synchs outside of the default merge schedule.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  2. Thomas Kozubek 0 Reputation points
    2025-07-14T14:23:44.7133333+00:00

    I've run into the very same issue with a production database.
    I checked EVERYTHING (along with ChatGPT/Copilot) - nothing helps.
    Interestingly, we've got lots of other subscriptions on the same server as well as the same publisher - even on the same database(!) - and they are working fine, except for only the one failing...

    It cannot be an authentication issue - and I could not find any merge replication setup meta data mismatch either.

    There is also nothing to find about Microsoft error MSSQL_REPL-2147199368... or on:

    Message: {call sp_MSensure_single_instance (N'DEBR-SQL-010-HB-DBWORKS-PubDBWorks-INGU-SQL-01-81', 4)}

    2025-07-14 11:12:40.802 Percent Complete: 0

    2025-07-14 11:12:40.802 Category:SQLSERVER

    Source: DEBR-SQL-010

    Number: 21036

    If anybody has any idea (except of to recreate the subscription - which we are doing on a separate copy, but it takes a lot of time, even without re-initializing), it would be very helpful.
    TKo

    Was this answer helpful?

    0 comments No comments

  3. Seeya Xi-MSFT 16,761 Reputation points
    2022-12-27T07:36:45.157+00:00

    Hi @Gao Peng ,

    When you dropped the subscription and recreated it again the subscriber was able to run the replication agent again.
    In addition, please refer to this blog: https://techcommunity.microsoft.com/t5/sql-server-support-blog/how-to-find-sql-server-replication-related-jobs-and-t-sql/ba-p/1530496
    Hope this would give you some help.

    Best regards,
    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.