如何侦听SQL Server数据库更改

时间:2022-05-15 07:13:36

Using .Net 4.0 and SQL Server 2008 R2

使用.Net 4.0和SQL Server 2008 R2

I have been looking into utilizing SqlDependency / SqlNotifications for monitoring some database structures. Is the best process / practice for this to utilize the SqlDependency / SqlNotifications with SQL Server Service broker?

我一直在研究利用SqlDependency / SqlNotifications来监控一些数据库结构。对SQL Server服务代理使用SqlDependency / SqlNotifications是最好的过程/实践吗?

Are folks using other methods to accomplish a similar task? I could always poll for changes, but I would rather not have to do that. On the other hand I don't want to introduce a complex scenario into our existing environment either.

人们是否使用其他方法来完成类似的任务?我总是可以轮询变化,但我宁愿不必那样做。另一方面,我也不想在我们现有的环境中引入复杂的场景。

EDIT (Potential Options):

编辑(潜在选项):

  1. SqlDependency
  2. Service Broker External Activation
  3. Service Broker外部激活

1 个解决方案

#1


3  

Check out event notifications:

查看活动通知:

http://msdn.microsoft.com/en-us/library/ms175854.aspx

#1


3  

Check out event notifications:

查看活动通知:

http://msdn.microsoft.com/en-us/library/ms175854.aspx