Name

AUDIT (Schema Objects)

Synopsis

AUDIT
object_privilege[,object_privilege
...] ON
{[schema.]object_name
| DEFAULT}
[BY SESSION [WHENEVER [NOT] SUCCESSFUL]
   [BY ACCESS [WHENEVER [NOT] SUCCESSFUL]

Sets up auditing for a specific schema object (object_name).

Keywords

object_privilege

Indicates that a particular operation is to be audited. The following are valid operations: ALTER, AUDIT, COMMENT, DELETE, EXECUTE, GRANT, INDEX, INSERT, LOCK, RENAME, SELECT, and UPDATE. The keyword ALL is equivalent to specifying all of the operations listed.

DEFAULT

Establishes the specified object options as the default for objects that have not yet been created.

BY SESSION

Causes Oracle to write a single record for all SQL statements of the same type issued in the same session.

BY ACCESS

Causes Oracle to write a single record for each audited statement.

WHENEVER SUCCESSFUL

Chooses auditing only for SQL statements that complete successfully.

WHENEVER NOT SUCCESSFUL

Chooses auditing only for SQL statements that fail or result in errors.

Notes

You must own the object to be audited or have the AUDIT SYSTEM privilege to issue this command. Audit records are written to the audit trail, a database table containing audit records that can be accessed through data dictionary views. Note that auditing must be enabled using the INIT.ORA parameter AUDIT_TRAIL.

Examples

The following example audits for any UPDATE statement issued for scott’s bonus table:

AUDIT UPDATE ON scott.bonus

The following example audits for any unsuccessful ...

Get Oracle Database Administration: The Essential Refe now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.