locked
Replication sync RRS feed

  • Question

  • Hi All,

    can i resync publication/subscription through query? Actually currently i doing it through right click on pub/subs from replication monitor.

    Please provide query.


    MnSap

    Sunday, June 7, 2020 7:12 PM

All replies

  • Hi MnSap,

    There seems to be no such T-SQL statement that can be used to synchronize publication/subscription.In addition to using SSMS, you can also synchronize subscriptions programmatically and on-demand by invoking the appropriate replication agent executable file from the command prompt.

    Please refer to following articles:
    Synchronize a Push Subscription

    Synchronize a Pull Subscription

    Best Regards,
    Cris


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 8, 2020 9:29 AM
  • You can use sp_startpublication_snapshot SP to restart the SnapShot Agent and then restart Log Read Agent to resync the subscriber.

    You can resync the Replication using sp_reinitpullsubscription running from Subscriber. From Publisher, the calling SP will be sp_reinitsubscription.

    sp_reinitpullsubscription can be called from the Subscriber to reinitialize the subscription, during the next run of the Distribution Agent.

    Check for more information : https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-reinitpullsubscription-transact-sql?view=sql-server-ver15

    Monday, June 8, 2020 11:19 AM
  • Hi MnSap,

    Is there any update on this case? Was your issue resolved? 

    If you have resolved your issue, please mark the useful reply as answer. This can be beneficial to other community members reading the thread.

    In addition, if you have another questions, please feel free to ask.
    Thanks for your contribution.

    Best regards,
    Cris


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, June 10, 2020 1:16 AM
  • DBA_Atul is correct, to start the distributioin agents you can use sp_start_job to start the distribution agent.
    Wednesday, June 10, 2020 2:41 PM
    Answerer
  • Hi MnSap,

    Is there any update on this case?
    Please feel free to drop us a note if there is any update.
    Have a nice day!

    Best Regards,
    Cris


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 15, 2020 1:26 AM