如何在 SQL Server 2008 中写入外部审计数据库?

发布于 2024-11-19 16:38:36 字数 268 浏览 8 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不再见 2024-11-26 16:38:36

创建触发器时,您可以选择指定凭据:请参阅“执行方式”(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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文