How to get replication status from code
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
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.
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.
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)
精彩评论