How to start replication agent in command prompt.

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

clip_image001[20]  

After stopping the job.Disable it.

clip_image001[22]

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)

clip_image001[4] 

Open a command prompt and Change the directory to C:\Program files\Microsoft Sql Server\100\COM in command prompt.

clip_image001

Running Logreader agent from command prompt:

Double click Log reader Job.

  clip_image001[6]

Select steps –>Double click Run agent.

clip_image001[10]

Copy the command and paste it in command prompt.

clip_image001[8]

To run Log read agent from cmd  type logread.exe in command prompt.Then paste the command that you copied from Job step properties.

clip_image001[12]

We can monitor the progress of agent from  command prompt.

clip_image001[14]

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).

clip_image001[40]

Like below.

clip_image001[42]

Running Replication distributor agent:

Double click the distributor job.

clip_image001[16]

Then select steps->Run agent.

clip_image001[18]

Copy the command.

clip_image001[24]

Change the directory to C:\Program files\Microsoft SQL Server\100\COM.

Then give distrib.exe –>copy the command from Job step properties.

clip_image001[28]

Now we could start distributor agent in command prompt itself.

clip_image001[30]

Running Snapshot agent:

Double click snapshot agent.

clip_image001[32]

Select Steps->Run agent.

clip_image001[34]

Change the directory to C:\Program files\Microsoft SQL Server\100\COM.

Then give snapshot.exe –>copy the command from Job step properties.

clip_image001[36]

Then we could start the snapshot agent in command prompt.

clip_image001[38]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s