About Custom Unified Audit Policies
You can create custom unified audit policies for specialized needs that are typically not met with predefined unified audit policies.
For example, you may have the following audit requirements:
-
Audit access to the database from untrusted database connection paths.
-
Audit access to specific sensitive database objects.
-
Audit use of certain system privileges.
To create the unified audit policy, you use the CREATE AUDIT POLICY statement. The AUDIT and NOAUDIT SQL statements enable and disable audit policies respectively. The AUDIT statement also lets you include or exclude specific users for the policy.
You can have more than one custom unified audit policy effective at any given time. An audit policy can contain both system-wide and object-specific audit options. To find system actions to audit, you can query the AUDITABLE_SYSTEM_ACTIONS system table.
Auditing In The Age of AI
As Agentic AI systems become increasingly autonomous and capable of executing complex operations at machine speed, auditing emerges as an inevitable cornerstone of modern cybersecurity.
By monitoring how agents invoke tools, exchange context, and execute tasks through MCP pipelines that interact with Oracle Database, you gain visibility into the data access patterns driving autonomous AI actions.
Unified Auditing plays a pivotal role in providing end-to-end visibility into how agentic AI systems access the database through MCP pipelines. When an agentic system issues MCP-orchestrated SQL operations to Oracle Database, Unified Auditing records not only the executed statements but also the context, user identity, and source of each action. This makes it much easier to spot unusual access patterns, unauthorized privilege use, or abnormal data extraction triggered by AI automation.
Oracle SQLcl MCP Server identifies itself to the Oracle Database session using the PROGRAM, MODULE, and ACTION properties in V$SESSION. The interactions with MCP Server can be logged into UNIFIED_AUDIT_TRAIL using the following statement:
AUDIT CONTEXT NAMESPACE userenv ATTRIBUTES module, action;
A sample Unified Audit record below shows the interaction between SQLcl MCP server and GitHub Copilot agent, querying records in an Oracle Database using Claude LLM.
SELECT client_program_name,
sql_text,
application_contexts
FROM unified_audit_trail
WHERE client_program_name = 'SQLcl-MCP';
CLIENT_PROGRAM_NAME SQL_TEXT APPLICATION_CONTEXTS
------------------- ---------------------------------------------------------- ---------------------------------------------------------------
SQLcl-MCP SELECT /* LLM in use is claude-3.5-sonnet */ EMPLOYEE_ID, ... (USERENV,ACTION=run-sql); (USERENV,MODULE=claude-3.5-sonnet)