如何在 SQL Server 2008 中写入外部审计数据库?
我有一个 SQL Server 2008 数据库,有 10 个 Windows 用户,他们都有权插入、更新和删除表。每个表都有一个触发器,用于写入不同数据库中的审计表。
目前,为了使其工作,我还必须授予用户对审核数据库的写入权限,否则触发器将引发错误。
我只能为每个单独的用户授予插入权限,但我希望对于这个问题可能有一个更优雅的解决方案。特别是从用户被删除/添加的角度来看,这意味着将它们设置在两个数据库而不是一个数据库中。
理想情况下,我想使用一个帐户来完成所有审计工作。
I have a SQL Server 2008 database with 10 windows users who all have permissions to Insert, Update and Delete tables. Each table has a trigger that writes to an audit table in a different database.
Currently for this to work I have to give the user write permissions to the audit database as well, otherwise the trigger will throw an error.
I could give Insert permission only for each individual user, but I was hoping that there might be a more elegant solution for this problem. Especially from a standpoint that users get deleted/added which would mean setting them up in two databases rather than one.
Ideally I would like to use one account that does all the audit work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建触发器时,您可以选择指定凭据:请参阅“执行方式”(http://msdn.microsoft.com/en-us/library/ms189799.aspx 和 http://msdn.microsoft.com/en-us/library/ms188354.aspx)。
When you create a trigger you have the option to specify credentials: see "Execute As" (http://msdn.microsoft.com/en-us/library/ms189799.aspx and http://msdn.microsoft.com/en-us/library/ms188354.aspx).