We have a SQL Express 2016 instance that is doing merge replication to a SQL 2016 box. This is an upgraded instance on both sides. We upgraded from SQL Express 2012 to 2016 and we moved the database to a SQL 2016 instance.

Merge replication triggered by a batch file with the following parameters (server, distributor, and subscription info changed to numbers)

REM -- Declare the variables.
SET Publisher=1111111
SET Distributor=2222222
SET Subscriber=3333333\SQLEXPRESS
SET PublicationDB=44444444
SET SubscriptionDB=555555555
SET Publication=666666666

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\130\COM\REPLMERG.EXE" -Publication %Publication% -Publisher %Publisher%  -Subscriber  %Subscriber%  -Distributor %Distributor%  -PublisherDB %PublicationDB%  -SubscriberDB %SubscriptionDB% -PublisherSecurityMode 0  -OutputVerboseLevel 2  -SubscriberSecurityMode 1  -SubscriptionType 1 -DistributorSecurityMode 0  -Validate 3  -ParallelUploadDownload 1 

When the batch file is ran, it shows in the replication log file that it cannot connect to the distributor.

ERROR: ErrNo = 0x80045901, ErrSrc = <null>, ErrType = 9, ErrStr = The process could not connect to Distributor '2222222'.

I can manually trigger the replication from my account (I'm a DBA).

Am I just missing a username and password for this to automatically merge when the batch file is called or am I missing something blatantly obvious in my batch file?

  • What account the batch file is running as ? – Kin Shah Feb 11 '19 at 21:07

REPLMERG.EXE . . . -DistributorSecurityMode 0 . . .

Per the command line parameters for replmerg.exe

-DistributorSecurityMode [ 0| 1]

Specifies the security mode of the Distributor. A value of 0 indicates SQL Server Authentication Mode (default), and a value of 1 indicates Windows Authentication Mode.

But you did not include

-DistributorLogin distributor_login Is the Distributor login name.
-DistributorPassword distributor_password Is the Distributor password.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.