Introduction to Unified Auditing and steps to configure it

Introduction

Unified Auditing is Oracle’s modern auditing framework introduced in Oracle Database 12c. It consolidates multiple audit mechanisms into a single, centralized audit trail.

Before Unified Auditing, Oracle used separate audit systems such as:

  • Standard Auditing
  • Fine-Grained Auditing (FGA)
  • RMAN Auditing
  • Database Vault Auditing
  • Label Security Auditing

Unified Auditing combines all these into one architecture.

Key Features

  • Centralized Audit Trail -> All audit records are stored in: UNIFIED_AUDIT_TRAIL view
  • Better Performance -> It Uses SGA queue buffering which helps in reducing disk I/O. And, Supports queued or immediate write modes.
  • Policy-Based Auditing -> Auditing is configured using reusable policies. Example, Audit CREATE TABLE, Audit failed logins, Audit actions by specific users, etc.
  • Multitenant Support -> It supports CDB/PDB, Common/local policies.

Unified Auditing Architecture

ComponentDescription
CREATE AUDIT POLICYDefines audit rules
AUDIT POLICYEnables policy
UNIFIED_AUDIT_TRAILView audit records
DBMS_AUDIT_MGMTAudit management package
AUDSYS.AUD$UNIFIEDInternal audit table

Types of Auditing Supported

TypeExample
Privilege auditingCREATE USER
Statement auditingCREATE TABLE
Object auditingSELECT on HR.EMP
Role auditingDBA role usage
Fine-Grained AuditingSensitive row access
Conditional auditingAudit only APP_USER

Step-by-Step Configuration of Unified Auditing

Step 1:  Enable the Unified Auditing and Disable the traditional auditing

At first, we will check the current status of unified auditing and traditional auditing. If the traditional auditing is enabled, we will disable it. Then, we will bring down the database.

Now, we will relink the Oracle kernel executable (oracle) with Unified Auditing enabled.

Bring up the DB and check the status of unified Auditing.

Step 2: Changing the default tablespace for the Unified Auditing

Create the tablespace for storing audit trail. And, assign it to unified auditing

 Step 3: Changing the default Partition Interval to 1 Day for the Unified Auditing

Step 4: Create an Unified Audit Policy – audit ALL actions for the user app_user.

Create a test user “APP_USER”

Now, let’s create a policy and apply it

Now, we will run some commands with “APP_USER” to generate some audit logs.

Here we did face an error, that the user was not having privilege to write on tablespace USERS. To solve this issue run below command as sysdba

Now, we will view the audit trails to check the records

Here, we can see that the actions performed by user “APP_USER” are getting recorded in audit trails.

Purging the Audit Trails

Manual Purging

The Manual purging can be performed by running below set of commands.

Purging audit trails using a scheduled job

To view the details of the job we can use below select statement

How to view the list of active audit policies

In the below snap we can see that there are few preconfigured audit policies and at bottom we can see our configured audit policy (underlined for reference).