Auditing Policy
Security administrators should define a policy for the auditing procedures of each database. You may decide to have database auditing disabled unless questionable activities are suspected. When auditing is required, decide what level of detail to audit the database; usually, general system auditing is followed by more specific types of auditing after the origins of suspicious activity are determined. Auditing is discussed in the following section.
Overview of Database Auditing
Auditing is the monitoring and recording of selected user database actions. It can be based on individual actions, such as the type of SQL statement run, or on combinations of factors that can include name, application, time, and so on. Security policies can cause auditing when specified elements in an Oracle database are accessed or altered, including content.
Auditing is generally used to:
-
Enable future accountability for current actions taken in a particular schema, table, or row, or affecting specific content
-
Investigate suspicious activity. For example, if an unauthorized user is deleting data from tables, then the security administrator could audit all connections to the database and all successful and unsuccessful deletions of rows from all tables in the database.
-
Monitor and gather data about specific database activities. For example, the database administrator can gather statistics about which tables are being updated, how many logical I/Os are performed, or how many concurrent users connect at peak times.
You can use Enterprise Manager to view and configure audit-related initialization parameters and administer audited objects for statement auditing and schema object auditing. For example, Enterprise Manager shows the properties for current audited statements, privileges, and objects. You can view the properties of each object, and you can search audited objects by their properties. You can also turn on and turn off auditing on objects, statements, and privileges.
Types and Records of Auditing
Oracle allows audit options to be focused or broad. You can audit:
-
Successful statement executions, unsuccessful statement executions, or both
-
Statement executions once in each user session or once every time the statement is run
-
Activities of all users or of a specific user
Oracle auditing enables the use of several different mechanisms, with the following features:
Audit Records and the Audit Trails
Audit records include information such as the operation that was audited, the user performing the operation, and the date and time of the operation. Audit records can be stored in either a data dictionary table, called the database audit trail, or in operating system files, called an operating system audit trail.
Database Audit Trail
The database audit trail is a single table named SYS.AUD$
in the SYS
schema of each Oracle database's data dictionary. Several predefined views are provided to help you use the information in this table.
Audit trail records can contain different types of information, depending on the events audited and the auditing options set. The following information is always included in each audit trail record, if the information is meaningful to the particular audit action:
-
User name
-
Instance number
-
Process identifier
-
Session identifier
-
Terminal identifier
-
Name of the schema object accessed
-
Operation performed or attempted
-
Completion code of the operation
-
Date and time stamp
-
System privileges used
Auditing in a Distributed Database
Auditing is site autonomous. An instance audits only the statements issued by directly connected users. A local Oracle node cannot audit actions that take place in a remote database. Because remote connections are established through the user account of a database link, statements issued through the database link's connection are audited by the remote Oracle node.
Operating System Audit Trail
Oracle allows audit trail records to be directed to an operating system audit trail if the operating system makes such an audit trail available to Oracle. If not, then audit records are written to a file outside the database, with a format similar to other Oracle trace files.
Oracle allows certain actions that are always audited to continue, even when the operating system audit trail (or the operating system file containing audit records) is unable to record the audit record. The usual cause of this is that the operating system audit trail or the file system is full and unable to accept new records.
System administrators configuring operating system auditing should ensure that the audit trail or the file system does not fill completely. Most operating systems provide administrators with sufficient information and warning to ensure this does not occur. Note, however, that configuring auditing to use the database audit trail removes this vulnerability, because the Oracle database server prevents audited events from occurring if the audit trail is unable to accept the database audit record for the statement.
Operating System Audit Records
The operating system audit trail is encoded, but it is decoded in data dictionary files and error messages.
-
Action code describes the operation performed or attempted. The
AUDIT_ACTIONS
data dictionary table describes these codes. -
Privileges used describes any system privileges used to perform the operation. The
SYSTEM_PRIVILEGE_MAP
table describes all of these codes. -
Completion code describes the result of the attempted operation. Successful operations return a value of zero, and unsuccessful operations return the Oracle error code describing why the operation was unsuccessful.
See Also:
-
Oracle Database Administrator's Guide for instructions for creating and using predefined views
-
Oracle Database Error Messages for a list of completion codes
Records Always in the Operating System Audit Trail
Some database-related actions are always recorded into the operating system audit trail regardless of whether database auditing is enabled:
-
At instance startup, an audit record is generated that details the operating system user starting the instance, the user's terminal identifier, the date and time stamp, and whether database auditing was enabled or disabled. This information is recorded into the operating system audit trail, because the database audit trail is not available until after startup has successfully completed. Recording the state of database auditing at startup also acts as an auditing flag, inhibiting an administrator from performing unaudited actions by restarting a database with database auditing disabled.
-
At instance shutdown, an audit record is generated that details the operating system user shutting down the instance, the user's terminal identifier, the date and time stamp.
-
During connections with administrator privileges, an audit record is generated that details the operating system user connecting to Oracle with administrator privileges. This record provides accountability regarding users connected with administrator privileges.
On operating systems that do not make an audit trail accessible to Oracle, these audit trail records are placed in an Oracle audit trail file in the same directory as background process trace files.
When Are Audit Records Created?
Any authorized database user can set his own audit options at any time, but the recording of audit information is enabled or disabled by the security administrator.
When auditing is enabled in the database, an audit record is generated during the execute phase of statement execution.
SQL statements inside PL/SQL program units are individually audited, as necessary, when the program unit is run.
The generation and insertion of an audit trail record is independent of a user's transaction being committed. That is, even if a user's transaction is rolled back, the audit trail record remains committed.
Statement and privilege audit options in effect at the time a database user connects to the database remain in effect for the duration of the session. Setting or changing statement or privilege audit options in a session does not cause effects in that session. The modified statement or privilege audit options take effect only when the current session is ended and a new session is created. In contrast, changes to schema object audit options become effective for current sessions immediately.
Operations by the SYS
user and by users connected through SYSDBA
or SYSOPER
can be fully audited with the AUDIT_SYS_OPERATIONS
initialization parameter. Successful SQL statements from SYS
are audited indiscriminately. The audit records for sessions established by the user SYS
or connections with administrative privileges are sent to an operating system location. Sending them to a location separate from the usual database audit trail in the SYS
schema provides for greater auditing security.