How to get replication status from code

孤街醉人 提交于 2019-12-24 01:46:12

问题


I have done replication on my SQL Server 2005 database. Now i want to show the status from my GUI.(Can be C# or else)

Is there is any method or API by which i can monitor the status of replication. This is for client confirmation that replication is working.

Thanks

Way something like this. http://www.sqlmonster.com/Uwe/Forum.aspx/sql-server-replication/11698/How-to-get-the-replication-status-using-RMO-in


回答1:


A great option is this: How to Programmatically Monitor Replication (via T-SQL): http://msdn.microsoft.com/en-us/library/ms147874(SQL.90).aspx

And here's the SQL Server 2008 R2 version for anyone looking at this as well: http://msdn.microsoft.com/en-us/library/ms147874(SQL.100).aspx

Using these special procedures can be a tiny bit of a pain from within T-SQL (as you'll commonly want to export their output into temp tables or table variables to 'filter it' an additional bit or what-not), but most devs will find this kind of interaction MUCH easier to deal with than using RMOs.




回答2:


I like to use tracer tokens posted at regular intervals and then monitoring their status as they flow from publisher to distributor to subscriber. This can be done programatically with sp_posttracertoken at the publisher and checking the tracer token tables in the distributor. Hope this helps.




回答3:


Monitoring Replication with Replication Monitor

Microsoft SQL Server Replication Monitor is a graphical tool that allows you to monitor the overall health of a replication topology. Replication Monitor provides detailed information on the status and performance of publications and subscriptions...

How to: Start Replication Monitor (Replication Monitor)



来源:https://stackoverflow.com/questions/5194692/how-to-get-replication-status-from-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!