Sql-server – How to run merge agent job step on tsql

merge-replicationsql serversql-server-2008-r2t-sql

I'm having a problem with the merge replication and I want to try and run the job as a script on ssms so I can see the errors (I've tried almost everything else)
Original post

Screet Shot

Here is the script

-Publisher [Publisher\Instance] -PublisherDB [Database] -Publication [Publication _name] -Subscriber [Subscriber\Instance] -SubscriberDB [SubscriberDB] -Distributor [Distributor \Instance] -DistributorSecurityMode 1

i've tried exec and then entering that script but the problem is that this is a Replication Merge step and not tsql step.
Is there any way to run this script using tsql ?

Best Answer

In SQL Server parlance, an "Agent" is an external executable that runs outside the SQL Server process. What you see in the job step are the command line parameters for that executable, not a T-SQL script.

The Merge Replication Agent is actually an executable: replmerge.exe. If you want to execute this from outside the SQL Agent job, you would open the command prompt on the server, and run the replmerge.exe command, followed by the contents of the job step:

replmerge -Publisher [Publisher\Instance] -PublisherDB [Database] -Publication [Publication _name] -Subscriber [Subscriber\Instance] -SubscriberDB [SubscriberDB] -Distributor [Distributor \Instance] -DistributorSecurityMode 1

For more info on the replmerge executable, and the available parameters, see the online documentation.