Export (0) Print
Expand All

How to: Synchronize a Pull Subscription (Replication Programming)

Pull subscriptions can be synchronized programmatically and on-demand by invoking the appropriate replication agent executable file from the command prompt. The replication agent executable file that is invoked will depend on the type of publication to which the pull subscription belongs.

ms147343.note(en-US,SQL.90).gifNote:
Replication agents connect to the local server using the Windows Authentication credentials of the user who started the agent from the command prompt. These Windows credentials are also used when connecting to remote servers using Windows Integrated Authentication.

  1. From the command prompt or in a batch file, start the Replication Distribution Agent by running distrib.exe, specifying the following command-line arguments:

    • -Publisher
    • -PublisherDB
    • -Distributor
    • -DistributorSecurityMode = 1
    • -Subscriber
    • -SubscriberDB
    • -SubscriberSecurityMode = 1
    • -SubscriptionType = 1

    If you are using SQL Authentication, you must also specify the following arguments:

    • -DistributorLogin
    • -DistributorPassword
    • -DistributorSecurityMode = 0
    • -PublisherLogin
    • -PublisherPassword
    • -PublisherSecurityMode = 0
    • -SubscriberLogin
    • -SubscriberPassword
    • -SubscriberSecurityMode = 0

  1. From the command prompt or in a batch file, start the Replication Merge Agent by running replmerg.exe, specifying the following command-line arguments:

    • -Publisher
    • -PublisherDB
    • -PublisherSecurityMode = 1
    • -Publication
    • -Distributor
    • -DistributorSecurityMode = 1
    • -Subscriber
    • -SubscriberSecurityMode = 1
    • -SubscriberDB
    • -SubscriptionType = 1

    If you are using SQL Authentication, you must also specify the following arguments:

    • -DistributorLogin
    • -DistributorPassword
    • -DistributorSecurityMode = 0
    • -PublisherLogin
    • -PublisherPassword
    • -PublisherSecurityMode = 0
    • -SubscriberLogin
    • -SubscriberPassword
    • -SubscriberSecurityMode = 0

The following example starts the Distribution Agent to synchronize a pull subscription. All connections are made using Windows Authentication.

REM -- Declare the variables.
SET Publisher=%instancename%
SET Subscriber=%instancename%
SET PublicationDB=AdventureWorks
SET SubscriptionDB=AdventureWorksReplica 
SET Publication=AdvWorksProductsTran

REM -- Start the Distribution Agent.
REM -- The following command must be supplied without line breaks.
"C:\Program Files\Microsoft SQL Server\90\COM\DISTRIB.EXE" -Subscriber %Subscriber% 
-SubscriberDB %SubscriptionDB% -SubscriberSecurityMode 1 -Publication %Publication% 
-Publisher %Publisher% -PublisherDB %PublicationDB% -Distributor %Publisher% 
-DistributorSecurityMode 1 -Continuous -SubscriptionType 1

The following example starts the Merge Agent to synchronize a pull subscription. All connections are made using Windows Authentication.

REM -- Declare the variables.
SET Publisher=%instancename%
SET Subscriber=%instancename%
SET PublicationDB=AdventureWorks
SET SubscriptionDB=AdventureWorksReplica 
SET Publication=AdvWorksSalesOrdersMerge

REM --Start the Merge Agent with concurrent upload and download processes.
REM -- The following command must be supplied without line breaks.
"C:\Program Files\Microsoft SQL Server\90\COM\REPLMERG.EXE" -Publication %Publication%  
-Publisher %Publisher%  -Subscriber  %Subscriber%  -Distributor %Publisher%  
-PublisherDB %PublicationDB%  -SubscriberDB %SubscriptionDB% -PublisherSecurityMode 1  
-OutputVerboseLevel 2  -SubscriberSecurityMode 1  -SubscriptionType 1 -DistributorSecurityMode 1  
-Validate 3  -ParallelUploadDownload 1 

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft