简体   繁体   English

Oracle DB审核全部

[英]Oracle DB Audit ALL

I have a 5TB large database. 我有一个5TB的大型数据库。

I want to audit everything , really everything. 我想审核所有内容,实际上是所有内容。

First of all, I tried with AUDIT ALL , but according to Oracle's document AUDIT ALL does NOT audit everything ... 首先,我尝试使用AUDIT ALL ,但是根据Oracle的文档AUDIT ALL does NOT审核所有内容 ...

I know that this statement must be executed in order to start auditing db: 我知道必须执行此语句才能开始审核数据库:

 alter system set audit_trail=db,extended scope=spfile;

But what else should I do to start auditing all the SQL statements that users execute? 但是,我应该怎么做才能开始审核用户执行的所有SQL语句?

You need not to use the AUDIT feature if you only want a view on user queries ( SELECT , UPDATE , INSERT ) on your database. 如果只想查看数据库中的用户查询( SELECTUPDATEINSERT ),则不需要使用AUDIT功能。 $AUD contains rather DDL statements , whereas V$SQL contains only DML statements . $AUD包含DDL语句 ,而V$SQL仅包含DML语句

A very simple solution is to use another view: V$SQL . 一个非常简单的解决方案是使用另一个视图: V$SQL You can extract duration and lot of useful info from it. 您可以从中提取持续时间和许多有用的信息。

Useful example: 有用的例子:

  SELECT * FROM v$sql vv
   WHERE lower(vv.SQL_TEXT) like '%delete%'
     AND vv.PARSING_SCHEMA_NAME like 'A_SCHEMA%'
ORDER BY  vv.LAST_ACTIVE_TIME desc;

V$SQL lists statistics on shared SQL area without the GROUP BY clause and contains one row for each child of the original SQL text entered. V$SQL列出不具有GROUP BY子句的共享SQL区域的统计信息,并为输入的原始SQL文本的每个子项包含一行。 Statistics displayed in V$SQL are normally updated at the end of query execution. V$SQL中显示的统计信息通常在查询执行结束时进行更新。

Long running queries are updated every 5 seconds. 长时间运行的查询每5秒更新一次。 This shows the impact of long running SQLs while they are still working. 这显示了长时间运行的SQL仍在起作用的影响。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM