Question

I am trying to monitor continuous replication status using transact sql from c# application. From my c# application i successfully start the job by using this..

exec sp_startpushsubscription_agent
   @publication = 'myPublication',
   @subscriber = 'my_subscriber_server_name',
   @subscriber_db = 'my_subscriber_db'

Now, I want to know whether my synchronization is complete or not or any error occurred. When the process is finished i want to give a successful message to the user.

Any help?

Was it helpful?

Solution

Yes, we can programmatically monitor replication using T-SQL or by using Replication Management Objects (RMO). Please see Programmatically Monitor Replication for examples.

I prefer to use RMO for this, starting the agent and handling the Status Event and displaying the agent status on a form. I have an example of how to do this for the Merge Agent on my blog: http://www.sqlrepl.com/sql-server/implementing-a-replication-agent-progess-bar/

The same thing could be done for the Distribution Agent.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top