Document 2212196.1
Document 2212196.1
1
Copy right (c) 2025, Oracle. A ll rights reserv ed. Oracle Confidential.
How To Transfer Unified Audit Records To An Internal Relational Table (Doc ID 2212196.1)
In this Document
Goal
Solution
References
APPLIES TO:
GOAL
How to transfer unified audit records that were in a pre-upgraded Oracle database to an internal relational table that is
designed to improve read performance.
SOLUTION
The DBMS_AUDIT_MGMT.TRANSFER_UNIFIED_AUDIT_RECORDS procedure can be used to transfer the audit data from the
internal CLI structures to the internal table :
The procedure is available out of the box in the Oracle RDBMS 12.2 database and in the Oracle RDBMS 12.1.0.2 databases
that have been patched with Patch 28186466.
It is not mandatory to run DBMS_AUDIT_MGMT.TRANSFER_UNIFIED_AUDIT_RECORDS after an upgrade, but for better read
performance of the unified audit trail, Oracle highly recommends that you run this procedure. The
DBMS_AUDIT_MGMT.TRANSFER_UNIFIED_AUDIT_RECORDS is designed to deal with predefined number of rows from CLI
back end table per execution. Depending on the number of rows present in the CLI back end table, you may have to
execute TRANSFER procedure more than once. It is NOT RECOMMENDED to run this transfer procedure concurrently;
especially in a RAC setup, while one instance has already initiated the TRANSFER other instance shouldn't be invoking it.
Running transfer procedure concurrently in multiple instances could lead to duplication of unified audit records. Also, it is
NOT RECOMMENDED to run this transfer procedure concurrently from multiple sessions of the same instance as well.
If there are many audit records then we must run this procedure in a loop. Please make sure to not run this procedure in
an infinite loop to avoid the potential system hang and impact on ongoing audit record writes:
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=19dm1dtidg_693&id=2212196.1 1/5
16/4/25, 11:29 Document 2212196.1
begin
DBMS_AUDIT_MGMT.FLUSH_UNIFIED_AUDIT_TRAIL;
DBMS_AUDIT_MGMT.TRANSFER_UNIFIED_AUDIT_RECORDS;
end loop;
end;
After the above loop will be executed one has to check the number of rows from the source ( gv$unified_audit_trail ) and
the destination (audsys.aud$unified) :
Example:
COUNT(*)
----------
10002
COUNT(*)
----------
COUNT(*)
----------
6001
COUNT(*)
----------
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=19dm1dtidg_693&id=2212196.1 2/5
16/4/25, 11:29 Document 2212196.1
4003
COUNT(*)
----------
9486
COUNT(*)
----------
524
COUNT(*)
----------
10010
COUNT(*)
----------
SQL> select count(*), event_timestamp from unified_audit_trail group by event_timestamp having count(*) > 1;
no rows selected
SQL>
Please consider running this TRANSFER procedure during low system loads to avoid system hangs, because this procedure
internally tries to move the unified audit records from CLI sources to a newly introduced Oracle defined partitioned
relational table. Running this transfer procedure in a long loop could just hang the system.
When number of rows in the CLI back end table (AUDSYS.CLI_SWP$.. table) are considerably less (10 or less), we can
expect a very good improvement in the read performance of UNIFIED_AUDIT_TRAIL view. Number of rows in CLI back end
tables would be reduced per execution of this transfer procedure.
If the unified audit record generation rate is too high then consider calling transfer procedure more frequently for better
read performance of UNIFIED_AUDIT_TRAIL view.
There are cases when some Unified Audit records are not transferred to internal relational table even after Patch
25985768 is applied on 12.1.0.2:
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=19dm1dtidg_693&id=2212196.1 3/5
16/4/25, 11:29 Document 2212196.1
See Note 2435857.1 Some Unified Audit Records are not Transferred to Internal Relational Table after apply Patch
25985768 on 12.1.0.2
You can find the GUIDs for containers by querying the PDB_GUID column of the DBA_PDB_HISTORY data dictionary view.
GUID NAME
-------------------------------- ------------------------------------------------------------------
--------------------------------------------------------------
3E09703FB0AF1A7EE05XXXXXXXXXXXXX PDB$SEED
4402A42CE8DB203EXXXXXXXXXXXXXXXX PDB1
1DC10E160C914XXXXXXXXXXXXXXXXXXX PDB2
Note:
Applying Patch 25985768 does not change the way unified audit records are written on 12.1.0.2, which means - unified
audit records would continue to get written to CLI queues based on Unified audit write modes (QUEUED / IMMEDIATE),
there by not compromising on the faster writes. However, one must consider transferring these unified audit records from
CLI source table to Oracle defined internal relational table by explicitly invoking the TRANSFER procedure after flushing
(DBMS_AUDIT_MGMT.FLUSH_UNIFIED_AUDIT_TRAIL) the unified audit records from CLI queues to CLI back end tables.
Every invocation of this transfer procedure is expected generate one mandatory audit record for the procedure execution
itself, since this procedure is part of DBMS_AUDIT_MGMT package.
Oracle HIGHLY RECOMMENDS to ALWAYS query the published and documented view "UNIFIED_AUDIT_TRAIL" to view
the unified audit records. Please do not rely on internal views like (G)V$UNIFIED_AUDIT_TRAIL since you could get an
incomplete set of unified audit records post execution of this transfer procedure.
If a realm is defined around AUDSYS schema then the only users authorized to the realm can create objects in the
schema or the realm should be disabled temporarily until we apply this patch (Since this patch includes creation of
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=19dm1dtidg_693&id=2212196.1 4/5
16/4/25, 11:29 Document 2212196.1
objects under AUDSYS schema). Once the patch is successfully applied, we can re-enable those realms.
Warning: If for some reasons you are rolling back Patch 25985768 make sure to take a back up of unified audit records
from AUDSYS.AUD$UNIFIED table (unified audit internal table) into a separate table. Since, TRANSFER operation moves
the unified audit records to this relational table (AUDSYS.AUD$UNIFIED), as part of fix rollback we drop this internal
relational table. After successful rollback (fix un-patching) querying UNIFIED_AUDIT_TRAIL view does not show the
unified audit records from this table.
REFERENCES
NOTE:2435857.1 - Some Unified Audit Records are not Transferred to Internal Relational Table after apply Patch 25985768
on 12.1.0.2
BUG:26080410 - ORA-00600 [KZAN_SET_INTSQL] EXECUTING DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL
BUG:28186466 - DBMS_AUDIT_MGMT.TRANSFER_UNIFIED_AUDIT_RECORDS NOT FUNCTIONING
BUG:25985768 - TRANSFER_UNIFIED_AUDIT_RECORDS PROCEDURE FAILS WITH ORA-46385 ON RAC
BUG:22762669 - INCORRECT INSTANCE_NUMBER IN V$XML_AUDIT_TRAIL FOR ACTION=102
Didn't find what you are looking for?
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=19dm1dtidg_693&id=2212196.1 5/5