什么可能导致数据库中的一个用户触发触发器,而另一个用户则不触发触发器?
我有一个大型 Web 应用程序,它依赖数据库 (MSSSQL 2008) 触发器来执行其某些功能。它提供了一个网络界面,允许最终用户对数据库进行基于表单的更改。
问题是 - 当 Web 应用程序使用应用程序池中的一个用户 ID 运行时,数据库触发器不会被触发(它们具有日志记录功能,使我能够看到这一点);但如果我将 AppPool 中的用户 ID 更改为另一个用户名/密码,则会执行这些触发器。请注意,表更新在两种情况下都会执行。这是我能发现两种不同情况下系统行为之间的唯一区别。两个用户都具有 dbo 权限,并且能够读/写数据库。
对于可能导致这种情况的原因有什么想法吗?
谢谢。
*更新: 两个用户都不是系统管理员;我的所有数据库触发器都会发生这种情况。 *
*更新#2: 在深入研究问题后,我发现日志记录功能依赖于两个用户帐户行为不一致的队列(是的,我知道)。对我来说,这意味着两个帐户的权限在某种程度上不匹配,这很可能是问题的根源。 *
I have a large web application that relies on database (MSSSQL 2008) triggers to perform some of its functions. It offers a web-interface which allows the end user to make form-based changes to the database.
The issue is - when the web application is run with one userid in the apppool, the database triggers don't get triggered (they have logging functionality which enables me to see that); but if I change the userid in the AppPool to another username/password, these triggers are executed. Note that the table updates are performed in both scenarios. This is the only difference I can spot between the system behavior under the two different circumstances. Both users have dbo privileges, and are able to read/write into the database.
Any thoughts on what may be causing this?
Thanks.
*UPDATE:
Neither user is sysadmin; this happens for ALL of my database triggers. *
*UPDATE #2:
After digging more into the problem, I found out that the logging function was relying on a queue (yes, I know) that has inconsistent behavior for the two user accounts. To me this means that the permissions for both accounts are somehow mismatched and that is most likely the root of the problem. *
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,这是该特定用户帐户的一个不起眼的权限错误。当帐户从数据库中删除并重新添加时,触发器、日志记录和所有相关事件开始正常工作。
This turned out to be a nondescript permissions error for that particular user account. When the account was removed from the database and added back in - the triggers, logging, and all related events started working appropriately.