正确的方法来制作审计触发器 [英] Proper way to make audit triggers

查看:118
本文介绍了正确的方法来制作审计触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实施审核触发器的正确​​方法是什么。我发现了很多例子,但我仍然不确定实施的最佳方法是什么。我需要跟踪几张桌子上的变化。基本上我需要跟踪一切。我希望它干净整洁。

What is the proper way for implementing audit triggers. I found many examples but I am still not sure what is the best way to implement. I need to track changes on few tables. Basically I need to keep track of everything. I want it nice and clean.

推荐答案

请参阅此链接以了解如何实施 [审计跟踪]。
Refer this link to understand how to implement[Audit Trail].


制作触发器的正确方式实际上取决于您的数据库架构,您的应用程序,您的审计需求等等....例如*我们*目前审计大约150个敏感项目在20个表格中......我们不会关心其余的表格。



此链接讨论了几种可能的解决方案 http://stackoverflow.com/questions/1962398/creating-audit-triggers-in-sql-server [ ^ ]



当你说你需要的时候跟踪一切你的意思是更新,删除,插入...(回答应该是最后两个是)...当你审核更新时...你真的需要知道什么已更新或只是记录更新的事实。

当您明确定义了您的要求时,您才能真正确定正确的方式。



某些解决方案提供商使用的另一种方法是在每个表上显示列,以显示它们何时创建(以及谁)以及上次更新的时间(以及谁)...这非常简单地使用表触发器实现而无需购买第三方工具......并且还简化了后续的详细审计要求
The "proper" way to make triggers really depends on your database schema, your application, your need to audit etc etc .... for example *we* currently audit approximately 150 "sensitive" items across 20 tables ... we don''t "care" about the rest.

This link has discussions about several potential solutions http://stackoverflow.com/questions/1962398/creating-audit-triggers-in-sql-server[^]

When you say you need to track "everything" do you mean update, deletions, insertions ... (answer should probably be yes to the last two)... when you "audit" an update ... do you actually need to know what was updated or just the fact that the record was updated.
When you have defined clearly what your requirements are only then can you really determine the "proper" way.

An alternative that has been used by certain solution providers is to have columns on each table that show when they were created (and who by) and when they were last updated (and who by) ... this is very simply implemented using table triggers without having to purchase 3rd party tools ... and also simplifies the subsequent detailed audit requirements


如果您只是需要为几个表创建触发器我建议安装一些工具,如 ApexSQL Audit [ ^ ]在试用模式下使用它来制作审核触发器,然后检查它是如何完成的。而不仅仅是你的触发器。干净整洁:)
If you just need to make triggers for a few tables I suggest installing some tool like ApexSQL Audit[^] Use it in trial mode to make audit triggers and then examine how it is done. Than just make your triggers. Nice and clean :)


这篇关于正确的方法来制作审计触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆