2014年10月7日星期二

audit by session & by access

11g和12c里面,对ddl只能进行by access了,执行by session会32595错。
但是,仍然可以对权限进行by session,
比如 audit select any table by zyz by session,不会报错。可是它的效果仍然是by access(一个session会产生多条记录)。 这和以前的版本是完全一些样,语句通过了,效果仍然是by access。

目前,在orcale9的文档里才有这个说明,说ddl的只能用by access。

http://docs.oracle.com/cd/B10500_01/server.920/a96524/c25audit.htm
The AUDIT statement lets you specify either BY SESSION or BY ACCESS. However, several audit options can be set only BY ACCESS, including:
  • All statement audit options that audit DDL statements
  • All privilege audit options that audit DDL statements

For all other audit options, BY SESSION is used by default.


11g
http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_4007.htm#SQLRF53733
12c
http://docs.oracle.com/database/121/SQLRF/statements_4007.htm#SQLRF55571
BY SESSION
In earlier releases, BY SESSION caused the database to write a single record for all SQL statements or operations of the same type executed on the same schema objects in the same session. Beginning with this release of Oracle Database, both BY SESSION and BY ACCESS cause Oracle Database to write one audit record for each audited statement and operation. BY SESSION continues to populate different values to the audit trail compared with BY ACCESS. Oracle recommends that you include the BY ACCESS clause for all AUDIT statements, which results in a more detailed audit record. If you specify neither clause, then BY ACCESS is the default.
Note:
This change applies only to schema object audit options, statement options and system privileges that audit SQL statements other than data definition language (DDL) statements. The database has always audited BY ACCESS all SQL statements and system privileges that audit a DDL statement.
BY ACCESS
Specify BY ACCESS if you want Oracle Database to write one record for each audited statement and operation.
Note:
If you specify either a SQL statement shortcut or a system privilege that audits a data definition language (DDL) statement, then the database always audits by access. In all other cases, the database honors the BY SESSION or BY ACCESS specification.
For statement options and system privileges that audit SQL statements other than DDL, you can specify either BY SESSION or BY ACCESS. BY ACCESS is the default.

没有评论:

发表评论