Oracle 中的审计

2021-11-30 00:00:00 oracle triggers audit auditing

我需要一些 Oracle 审计方面的帮助.我们有一个包含许多表的数据库,我们希望能够审计对任何字段中的任何表所做的每一次更改.所以我们希望在这次审计中拥有的东西是:

I need some help in auditing in Oracle. We have a database with many tables and we want to be able to audit every change made to any table in any field. So the things we want to have in this audit are:

  • 修改的用户
  • 发生变化的时间
  • 旧价值与新价值

所以我们开始创建触发器,它应该对任何表执行审计,但后来出现问题......

so we started creating the trigger which was supposed to perform the audit for any table but then had issues...

正如我之前提到的,我们有很多表,我们无法为每个表创建一个触发器.因此,我们的想法是创建一个主触发器,该触发器可以为触发触发器的任何表动态运行.我正在尝试这样做,但一点也不幸运......似乎Oracle 仅针对由代码声明的表而不是像我们想要的那样动态地限制触发器环境.

As I mentioned before we have so many tables and we cannot go creating a trigger per each table. So the idea is creating a master trigger that can behaves dynamically for any table that fires the trigger. I was trying to do it but no lucky at all....it seems that Oracle restricts the trigger environment just for a table which is declared by code and not dynamically like we want to do.

您对如何执行此操作有任何想法或任何其他解决此问题的建议吗?

Do you have any idea on how to do this or any other advice for solving this issue?

推荐答案

您不需要编写自己的触发器.

You don't need write your own triggers.

Oracle 提供灵活且细粒度的审计跟踪服务.看看这个文档 (9i) 作为起点.(这是 10g 和 11g 版本的同一文档.)

Oracle ships with flexible and fine grained audit trail services. Have a look at this document (9i) as a starting point. ( Here's a link for 10g and 11g versions of the same document.)

您可以审核很多,以至于可以就像从消防软管中喝水 - 这可能会在某些时候损害服务器性能,或者可能会给您留下太多审计信息,以至于您将无法从中快速提取有意义的信息,和/或最终会占用大量磁盘空间.花一些时间思考您真正需要多少审核信息,以及您可能需要保留这些信息多长时间.为此,可能需要从基本配置开始,然后在您能够获得实际收集的审计跟踪数据量的样本后对其进行调整.

You can audit so much that it can be like drinking from the firehose - and that can hurt the server performance at some point, or could leave you with so much audit information that you won't be able to extract meaningful information from it quickly, and/or you could end up eating up lots of disk space. Spend some time thinking about how much audit information you really need, and how long you might need to keep it around. To do so might require starting with a basic configuration, and then tailoring it down after you're able to get a sample of the kind of volume of audit trail data you're actually collecting.

相关文章