In this blog I will explain how to run replication agents from command prompt and enable additional parameters for agent’s while running from command prompt.
All the replication agent’s (Snapshot agent, Logreader agent, distributor agent, Merge agent) can be run from command prompt.
All these replication agents will have corresponding exe in C:\Program files\Microsoft SQL Server\100\COM folder
Snapshot agent –>Snapshot.exe
Logreader agent—>Logread.exe
distributor agent –>Distrib.exe
Merge agent –>Replmerge.exe
Before we start running the replication agents from command prompt we have to stop and disable the corresponding agent job in management studio by expanding jobs->Right click job->Stop Job
After stopping the job.Disable it.
Copy the folder path in which replication agent exe’s are located ( C:\Program files\Microsoft SQL Server\100\COM I have highlighted the agent binaries for visibility)
Open a command prompt and Change the directory to C:\Program files\Microsoft Sql Server\100\COM in command prompt.
Running Logreader agent from command prompt:
Double click Log reader Job.
Select steps –>Double click Run agent.
Copy the command and paste it in command prompt.
To run Log read agent from cmd type logread.exe in command prompt.Then paste the command that you copied from Job step properties.
We can monitor the progress of agent from command prompt.
We can also add additional parameters when we run the agents from command prompt. I will show you how to add verbose level parameter to increase the level of logging when running agent from CMD. (–Outputverboselevel 3 increases the level of logging by replication agents).
Like below.
Running Replication distributor agent:
Double click the distributor job.
Then select steps->Run agent.
Copy the command.
Change the directory to C:\Program files\Microsoft SQL Server\100\COM.
Then give distrib.exe –>copy the command from Job step properties.
Now we could start distributor agent in command prompt itself.
Running Snapshot agent:
Double click snapshot agent.
Select Steps->Run agent.
Change the directory to C:\Program files\Microsoft SQL Server\100\COM.
Then give snapshot.exe –>copy the command from Job step properties.
Then we could start the snapshot agent in command prompt.