Administering The Audit Trail
Administering The Audit Trail
Guide
Writing the Unified Audit Trail Records to SYSLOG or the Windows Event Viewer
You can write the unified audit trail records to SYSLOG or the Windows Event Viewer
by setting an initialization parameter.
Moving Operating System Audit Records into the Unified Audit Trail
Audit records that have been written to the spillover audit files can be moved to the
unified audit trail database table.
Exporting and Importing the Unified Audit Trail Using Oracle Data Pump
You can include the unified audit trail in Oracle Database Pump export and import
dump files.
Oracle Database individually audits SQL statements inside PL/SQL program units, as necessary,
when the program unit is run.
To improve read performance of the unified audit trail, the unified audit records are written
immediately to disk to an internal relational table in the AUDSYS schema. In the previous
release, the unified audit records were written to SecureFile LOBs. If you had migrated to unified
auditing in Oracle Database 12c release 1 (12.1), then you can manually transfer the unified
audit records from the SecureFile LOBS to this internal table. If the version of the database that
you are using supports partitioned tables, then this internal table is a partitioned table. In this
case, you can modify the partition interval of the table by using the
and
DBMS_AUDIT_MGMT.ALTER_PARTITION_INTERVAL procedure. The partitioned version of
this table is based on the EVENT_TIMESTAMP timestamp as a partition key with a default
t of Tables 28 Administering th
partition interval of one month. If the database version does not support partitioning, then the
e and Copyright Information internal table is a regular, non-partitioned table.
28.1 Managing
face Trail
The generation and insertion of an audit trail record is independent of the user transaction
anges in This Release for
being committed. That is, even if a user transaction is rolled back, the audit trail record remains
28.2 Archiving t
acle Database Security Guide committed.
ntroduction to Oracle Database Security Statement and privilege audit options from unified audit policies that are in effect at the time a 28.3 Purging Au
database user connects to the database remain in effect for the duration of the session. When
t I Managing User Authentication
d Authorization the session is already active, setting or changing statement or privilege unified audit options 28.4 Audit Trail M
does not take effect in that session. The modified statement or privilege audit options take Dictionary Views
t II Application Development Security effect only when the current session ends and a new session is created.
t III Controlling Access to Data In contrast, changes to schema object audit options become immediately effective for current
sessions.
t IV Securing Data on the Network
By default, audit trail records are written to the AUDSYS schema in the SYSAUX tablespace. You
t V Managing Strong Authentication can designate a different tablespace, including one that is encrypted, by using the
t VI Monitoring Database Activity with
DBMS_AUDIT_MGMT.SET_AUDIT_TRAIL_LOCATION procedure.
diting
Related Topics
26 Introduction to Auditing
Writing the Unified Audit Trail Records to the AUDSYS Schema
27 Configuring Audit Policies
Oracle Database Upgrade Guide
28 Administering the Audit Trail Oracle Database PL/SQL Packages and Types Reference
28.1 Managing the Unified Audit Trail Parent topic: Managing the Unified Audit Trail
AUDIT
28.2 Archiving the Audit Trail
NOAUDIT
28.3 Purging Audit Trail Records
EXECUTE of the DBMS_FGA PL/SQL package
28.4 Audit Trail Management Data
Dictionary Views EXECUTE of the DBMS_AUDIT_MGMT PL/SQL package
pendixes ALTER TABLE attempts on the AUDSYS audit trail table (remember that this table
cannot be altered)
ossary
Top level statements by the administrative users SYS, SYSDBA, SYSOPER, SYSASM,
SYSBACKUP, SYSDG, and SYSKM, until the database opens. When the database
ex
opens, Oracle Database audits these users using the audit configurations in the
system—not just the ones that were applied using the BY clause in the AUDIT
statement, for example, but those that were applied for all users when AUDIT
statement does not have a BY clause or when the EXCEPT clause was used and
these users were not excluded.
All user-issued DML statements on the SYS.AUD$ and SYS.FGA_LOG$ dictionary
tables
Any attempts to modify the data or metadata of the unified audit internal table.
SELECT statements on this table are not audited by default or mandatorily.
Related Topics
Auditing is not affected by whether or not a cursor is shared. Each user creates her or his own
audit trail records on first execution of the cursor.
28.1.4 Writing the Unified Audit Trail Records to the AUDSYS Schema
Oracle Database automatically writes audit records to an internal relational table in the AUDSYS
schema.
In Oracle Database 12c release 1 (12.1), you had the option of queuing the audit records in
memory (queued-write mode) and be written periodically to the AUDSYS schema audit table.
However, starting with Oracle Database 12c release 2 (12.2), immediate-write mode and
queued-write mode are deprecated. The parameters that controlled them
(UNIFIED_AUDIT_SGA_QUEUE_SIZE,
DBMS_AUDIT_MGMT.AUDIT_TRAIL_IMMEDIATE_WRITE, and
DBMS_AUDIT_MGMT.AUDIT_TRAIL_QUEUED_WRITE), while still viewable, no longer have any
functionality.
The new functionality of having audit records always written to a relational table in the AUDSYS
schema prevents the risk of audit records being lost in the event of an instance crash or during
a SHUTDOWN ABORT operation. The new functionality also improves the performance of the
audit trail and the database as a whole.
If you have upgraded from Oracle Database 12c release 1 (12.1) and migrated to unified
auditing in that release, then Oracle recommends that you use the
DBMS_AUDIT_MGMT.TRANSFER_UNIFIED_AUDIT_RECORDS procedure to transfer the audit
records as generated in the previous release to the AUDSYS audit internal table. Oracle
Database Upgrade Guide provides information about transferring unified audit records after an
upgrade.
Related Topics
28.1.5 Writing the Unified Audit Trail Records to SYSLOG or the Windows
Event Viewer
You can write the unified audit trail records to SYSLOG or the Windows Event Viewer by setting
an initialization parameter.
About Writing the Unified Audit Trail Records to SYSLOG or the Windows Event
Viewer
With this feature, you can copy some of the key unified audit fields to SYSLOG or the
Windows Event Viewer.
Enabling SYSLOG and Windows Event Viewer Captures for the Unified Audit Trail
You can write a subset of unified audit trail records to the UNIX SYSLOG or to the
Windows Event Viewer.
28.1.5.1 About Writing the Unified Audit Trail Records to SYSLOG or the
Windows Event Viewer
With this feature, you can copy some of the key unified audit fields to SYSLOG or the Windows
Event Viewer.
Unlike traditional audit, only key fields of unified audit records in the UNIFIED_AUDIT_TRAIL
data dictionary view are copied to SYSLOG. SYSLOG records in a unified audit environment
provide proof of operational integrity.
You can configure this feature on both UNIX and Microsoft Windows systems. On Windows
systems, you either enable it or disable it. If enabled, it writes the records to the Windows Event
Viewer.
On UNIX systems, you can fine-tune the capture of unified audit trail records for SYSLOG to
specify the facility where the SYSLOG records are sent and the severity level of the records (for
example, DEBUG if it is capturing debugging-related messages).
Table 28-1 maps the names given to the unified audit records fields that are written to SYSLOG
and the Windows Event Viewer to the corresponding column names in the
UNIFIED_AUDIT_TRAIL view.
Table 28-1 Audit Record Field Names for SYSLOG and the Windows Event Viewer
Column Name in
Field Name UNIFIED_AUDIT_TRAIL Column Type Column Description
Parent topic: Writing the Unified Audit Trail Records to SYSLOG or the Windows Event Viewer
28.1.5.2 Enabling SYSLOG and Windows Event Viewer Captures for the Unified
Audit Trail
You can write a subset of unified audit trail records to the UNIX SYSLOG or to the Windows
Event Viewer.
Copy
UNIFIED_AUDIT_SYSTEMLOG = 'facility_clause.priority_
For example:
UNIFIED_AUDIT_SYSTEMLOG = 'LOCAL7.EMERG' Copy
You cannot set this parameter in a pluggable database (PDB). There is no Windows
equivalent of the UNIFIED_AUDIT_COMMON_SYSTEMLOG parameter.
4. Add the audit file destination to the SYSLOG configuration file /etc/syslog.conf.
For example, assuming you had set the UNIFIED_AUDIT_SYSTEMLOG to
LOCAL7.EMERG, enter the following:
Now, all audit records will be captured in the file /var/log/audit.log through
the syslog daemon.
SHUTDOWN IMMEDIATE
STARTUP Copy
If you set UNIFIED_AUDIT_SYSTEMLOG in a PDB, then close and reopen the PDB:
Related Topics
Parent topic: Writing the Unified Audit Trail Records to SYSLOG or the Windows Event Viewer
The default locations for unified audit spillover .bin files are as follows:
The ability to write to the database table can fail in situations such as the following: the audit
tablespace is offline, the tablespace is read-only, the tablespace is full, the database is read-only,
and so on. The unified audit records will continue to be written to OS spillover files until the OS
disk space becomes full. At this point, when there is no room in the OS for the audit records,
user auditable transactions will fail with ORA-02002 error while writing to audit
trail errors. To prevent this problem, Oracle recommends that you purge the audit trail on a
regular basis.
Related Topics
28.1.7 Moving Operating System Audit Records into the Unified Audit
Trail
Audit records that have been written to the spillover audit files can be moved to the unified
audit trail database table.
When the database is not writable (such as during database mounts), if the database is closed,
or if it is read-only, then Oracle Database writes the audit records to these external files. The
default location for these external files is the $ORACLE_BASE/audit/$ORACLE_SID directory.
You can load the files into the database by running the
DBMS_AUDIT_MGMT.LOAD_UNIFIED_AUDIT_FILES procedure. Be aware that if you are
moving a large number of operating system audit records in the external files, performance may
be affected.
To move the audit records in these files to the AUDSYS schema audit table when the database is
writable:
1. Log into the database instance as a user who has been granted the AUDIT_ADMIN
role.
For example:
CONNECT aud_admin
Enter password: password Copy
Connected.
In a multitenant environment, log into the CDB root with the AUDIT_ADMIN role.
Before you can upgrade to the current release or Oracle Database, you must execute
the DBMS_AUDIT_MGMT.LOAD_UNIFIED_AUDIT_FILES procedure from the CDB
root to avoid losing operating system spillover files during the upgrade process.
For example:
CONNECT c##aud_admin
Enter password: password Copy
Connected.
For a non-CDB architecture, to find if the database is open and writable, query the
V$DATABASE view.
NAME OPEN_MODE
--------------- ----------
HRPDB READ WRITE
In a multitenant environment, you can run the show pdbs command to find
information about PDBs associated with the current instance.
The audit records are loaded into the AUDSYS schema audit table immediately, and then
deleted from the $ORACLE_BASE/audit/$ORACLE_SID directory.
28.1.8 Exporting and Importing the Unified Audit Trail Using Oracle Data
Pump
You can include the unified audit trail in Oracle Database Pump export and import dump files.
The unified audit trail is automatically included in either full database or partial database export
and import operations using Oracle Data Pump. For example, for a partial database export
operation, if you wanted to export only the unified audit trail tables, then you could enter the
following commands: expdp command:
1. In SQL*Plus, move any operating system audit records that have been written to the
spillover audit files to the unified audit trail table. Doing so ensures that all records
will be exported.
2. From the operating system prompt, execute the following command:
expdp system
full=y Copy
directory=aud_dp_dir
logfile=audexp_log.log
dumpfile=audexp_dump.dmp
version=18.02.00.02.00
INCLUDE=AUDIT_TRAILS
Password: password
Next, you can import all the exported content by reading the export dump file. This operation
imports only the unified audit trail tables.
impdp system
full=y Copy
directory=aud_dp_dir
dumpfile=audexp_dump.dmp
logfile=audimp_log.log
Password: password
You do not need to perform any special configuration to achieve this operation. However, you
must have the EXP_FULL_DATABASE role if you are performing the export operation and the
IMP_FULL_DATABASE role if you are performing the import operation.
Related Topics
Moving Operating System Audit Records into the Unified Audit Trail
For example:
In a multitenant environment, this command shuts down all PDBs in the CDB.
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk uniaud_off ioracle Copy
In a multitenant environment, these actions disable unified auditing in all PDBs in the
CDB.
STARTUP Copy
Related Topics
To archive the traditional operating system audit trail from an upgraded database, use your
platform-specific operating system tools to create an archive of the traditional operating system
audit files.
Use the following methods to archive the traditional operating system audit files:
Use Oracle Audit Vault and Database Firewall. You install Oracle Audit
Vault and Database Firewall separately from Oracle Database.
Create tape or disk backups. You can create a compressed file of the
audit files, and then store it on tapes or disks. Consult your operating
system documentation for more information.
Afterwards, you should purge (delete) the traditional operating system audit records to facilitate
audit trail management.
Related Topics
Moving Operating System Audit Records into the Unified Audit Trail
Purging Audit Trail Records
Archiving and purging facilitate the purging of the database audit trail.
You can create an archive of the unified and traditional database audit trail by using Oracle
Audit Vault and Database Firewall. You install Oracle Audit Vault and Database Firewall
separately from Oracle Database.
After you complete the archive, you can purge the database audit trail contents.
Related Topics
Related Topics
You should periodically archive and then delete (purge) audit trail records. You can purge a
subset of audit trail records or create a purge job that performs at a specified time interval.
Oracle Database either purges the audit trail records that were created before the archive
timestamp, or it purges all audit trail records. You can purge audit trail records in both read-
write and read-only databases.
The purge process takes into account not just the unified audit trail, but audit trails from earlier
releases of Oracle Database. For example, if you have migrated an upgraded database that still
has operating system or XML audit records, then you can use the procedures in this section to
archive and purge them.
To perform the audit trail purge tasks, you use the DBMS_AUDIT_MGMT PL/SQL package. You
must have the AUDIT_ADMIN role before you can use the DBMS_AUDIT_MGMT package. Oracle
Database mandatorily audits all executions of the DBMS_AUDIT_MGMT PL/SQL package
procedures.
If you have Oracle Audit Vault and Database Firewall installed, the audit trail purge process
differs from the procedures described in this manual. For example, Oracle Audit Vault archives
the audit trail for you.
Note: Oracle Database audits all deletions from the audit trail, without
exception.
Related Topics
You can purge all audit records, or audit records that were created before a specified timestamp,
on a regularly scheduled basis.
For example, you can schedule the purge for every Saturday at 2 a.m.
1. If necessary, tune online and archive redo log sizes to accommodate the additional
records generated during the audit table purge process.
Related Topics
You can manually purge the audit records right away in a one-time operation, rather than
creating a purge schedule.
1. If necessary, tune online and archive redo log sizes to accommodate the additional
records generated during the audit table purge process.
Related Topics
You can purge the entire audit trail, or only a portion of the audit trail that was created before a
timestamp.
The individual audit records created before the timestamp can be purged.
Be aware that purging the audit trail, particularly a large one, can take a while to complete.
Consider scheduling the purge job so that it runs during a time when the database is not busy.
You can create multiple purge jobs for different audit trail types, so long as they do not conflict.
For example, you can create a purge job for the standard audit trail table and then the fine-
grained audit trail table. However, you cannot then create a purge job for both or all types, that
is, by using the DBMS_AUDIT_MGMT.AUDIT_TRAIL_DB_STD or
DBMS_AUDIT_MGMT.AUDIT_TRAIL_ALL property. In addition, be aware that the jobs created
by the DBMS_SCHEDULER PL/SQL package do not execute on a read-only database. An
automatic purge job created with DBMS_AUDIT_MGMT uses the DBMS_SCHEDULER package to
schedule the tasks. Therefore, these jobs cannot run on a database or PDB that is open in read-
only mode.
Parent topic: Scheduling an Automatic Purge Job for the Audit Trail
28.3.3.2 Step 1: If Necessary, Tune Online and Archive Redo Log Sizes
The purge process may generate additional redo logs.
If necessary, tune online and archive redo log sizes to accommodate the additional
records generated during the audit table purge process.
In a unified auditing environment, the purge process does not generate as many redo logs as in
a mixed mode auditing environment, so if you have migrated to unified auditing, then you may
want to bypass this step.
See Also:
Oracle Database Administrator’s Guide for more information about tuning log files
Parent topic: Scheduling an Automatic Purge Job for the Audit Trail
You must record the timestamp of the audit records before you can archive them.
Later on, when the purge takes place, Oracle Database purges only the audit trail records that
were created before the date of this archive timestamp.
After you have timestamped the records, you are ready to archive them.
Related Topics
Parent topic: Scheduling an Automatic Purge Job for the Audit Trail
If you want to delete all of the audit trail, then you can bypass this step.
You can set a timestamp for when the last audit record was archived. Setting an archive
timestamp provides the point of cleanup to the purge infrastructure. If you are setting a
timestamp for a read-only database, then you can use the
DBMS_AUDIT.MGMT.GET_LAST_ARCHIVE_TIMESTAMP function to find the last archive
timestamp that was configured for the instance on which it was run. For a read-write database,
you can query the DBA_AUDIT_MGMT_LAST_ARCH_TS data dictionary view.
To find the last archive timestamps for the unified audit trail, you can query the
DBA_AUDIT_MGMT_LAST_ARCH_TS data dictionary view. After you set the timestamp, all audit
records in the audit trail that indicate a time earlier than that timestamp are purged when you
run the DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL PL/SQL procedure. If you want to clear the
archive timestamp setting, see Clearing the Archive Timestamp Setting.
If you are using Oracle Database Real Application Clusters, then use Network Time Protocol
(NTP) to synchronize the time on each computer where you have installed an Oracle Database
instance. For example, suppose you set the time for one Oracle RAC instance node at 11:00:00
a.m. and then set the next Oracle RAC instance node at 11:00:05. As a result, the two nodes have
inconsistent times. You can use Network Time Protocol (NTP) to synchronize the times for these
Oracle RAC instance nodes.
1. Log into the database instance as a user who has been granted the AUDIT_ADMIN
role.
In a multitenant environment, log into either the root or the PDB in which you want
to schedule the purge job. In most cases, you may want to schedule the purge job
on individual PDBs.
CONNECT aud_admin@hrpdb
Enter password: password Copy
Connected.
2. Run the DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP PL/SQL procedure
to set the timestamp.
For example:
BEGIN
DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP( Copy
AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFI
LAST_ARCHIVE_TIME => '12-OCT-2013 06:30:00.00',
RAC_INSTANCE_NUMBER => 1,
CONTAINER => DBMS_AUDIT_MGMT.CONTAINER_CURRENT)
END;
/
In this example:
DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED_FILES
archives records from the operating system spillover files in
each database (primary or standby).
LAST_ARCHIVE_TIME specifies the timestamp in YYYY-MM-DD
HH:MI:SS.FF UTC (Coordinated Universal Time) format for
AUDIT_TRAIL_UNIFIED, AUDIT_TRAIL_AUD_STD, and
AUDIT_TRAIL_FGA_STD, and in the Local Time Zone for
AUDIT_TRAIL_OS and AUDIT_TRAIL_XML. Do not enter a future
system date or timestamp (for example, SYSDATE + 1, or a date in the
future) for this value.
RAC_INSTANCE_NUMBER specifies the instance number for an Oracle
RAC installation. This setting is not relevant for single instance databases.
If you specified the DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD or
DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD audit trail types, then
you can omit the RAC_INSTANCE_NUMBER argument. This is because
there is only one AUD$ or FGA_LOG$ table, even for an Oracle RAC
installation. The default is NULL. You can find the instance number for the
current instance by issuing the SHOW PARAMETER INSTANCE_NUMBER
command in SQL*Plus.
CONTAINER applies the timestamp to a multitenant environment.
DBMS_AUDIT_MGMT.CONTAINER_CURRENT specifies the current PDB;
DBMS_AUDIT_MGMT.CONTAINER_ALL applies to all PDBs in the
multitenant environment.
Note that you can set CONTAINER to DBMS_MGMT.CONTAINER_ALL
only from the root, and DBMS_MGMT.CONTAINER_CURRENT only from a
PDB.
Typically, after you set the timestamp, you can use the
DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL PL/SQL procedure to remove the audit
records that were created before the timestamp date.
Parent topic: Scheduling an Automatic Purge Job for the Audit Trail
You can use the DBMS_AUDIT_MGMT PL/SQL package to create and schedule the purge job.
For example:
CONNECT aud_admin@hrpdb
Enter password: password Copy
Connected.
BEGIN
DBMS_AUDIT_MGMT.CREATE_PURGE_JOB (
AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL
AUDIT_TRAIL_PURGE_INTERVAL => 12,
AUDIT_TRAIL_PURGE_NAME => 'Audit_Trail_PJ',
USE_LAST_ARCH_TIMESTAMP => TRUE,
CONTAINER => DBMS_AUDIT_MGMT.CONTAINER_C
END;
/
In this example:
For upgraded databases that still have audit data from previous releases:
DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD is used for the standard
audit trail table, AUD$. (This setting does not apply to read-only
databases.)
DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD is used for the fine-
grained audit trail table, FGA_LOG$. (This setting does not apply to read-
only databases.)
DBMS_AUDIT_MGMT.AUDIT_TRAIL_DB_STD is used for both standard
and fine-grained audit trail tables. (This setting does not apply to read-
only databases.)
DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS is used for the operating system
audit trail files with the .aud extension. (This setting does not apply to
Windows Event Log entries.)
DBMS_AUDIT_MGMT.AUDIT_TRAIL_XML is used for the XML operating
system audit trail files.
DBMS_AUDIT_MGMT.AUDIT_TRAIL_FILES is used for both operating
system and XML audit trail files.
DBMS_AUDIT_MGMT.AUDIT_TRAIL_ALL is used for all audit trail
records, that is, both database audit trail and operating system audit trail
types. (This setting does not apply to read-only databases.)
To purge records from the AUDSYS.AUD$UNIFIED table or from the operating
system spillover files:
DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED_TABLE purges records
from the AUDSYS.AUD$UNIFIED table.
TRUE deletes audit records created before the last archive timestamp. To
check the last recorded timestamp, query the LAST_ARCHIVE_TS
column of the DBA_AUDIT_MGMT_LAST_ARCH_TS data dictionary view
for read-write databases and the
DBMS_AUDIT_MGMT.GET_LAST_ARCHIVE_TIMESTAMP function for
read-only databases. The default value is TRUE. Oracle recommends that
you set USE_LAST_ARCH_TIMESTAMP to TRUE.
Parent topic: Scheduling an Automatic Purge Job for the Audit Trail
You can manually purge the audit trail right away, without scheduling a purge job.
Similar to a purge job, you can purge audit trail records that were created before an archive
timestamp date or all the records in the audit trail. Only the current audit directory is cleaned up
when you run this procedure.
For upgraded databases that may still have audit trails from earlier releases, note the following
about the DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL PL/SQL procedure:
1. If you have set the AUDIT_SYSLOG_LEVEL initialization parameter so that the audit
trail will be written to operating system log files (syslog), then check for the
following:
Ensure that the session ID that is associated with the audit trail files is not
owned by the PMON process.
If either of these conditions is true, then the audit trail cannot be purged.
2. Follow these steps under Scheduling an Automatic Purge Job for the Audit Trail:
If you created the purge job in the root, then you must log into the root. If you
created the purge job in a specific PDB, then log into that PDB.
For example:
CONNECT aud_admin@hrpdb
Enter password: password Copy
Connected.
For example:
BEGIN
DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL( Copy
AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL
USE_LAST_ARCH_TIMESTAMP => TRUE,
CONTAINER => DBMS_AUDIT_MGMT.CONTAINER_C
END;
/
In this example:
DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED_FILES
purges records from the operating system spillover files in
each database (primary or standby).
USE_LAST_ARCH_TIMESTAMP: Enter either of the following settings:
Setting the Default Audit Trail Purge Job Interval for a Specified Purge Job
You can set a default purge operation interval, in hours, that must pass before the
next purge job operation takes place.
For example, assuming that you had created the purge job in a the hrpdb PDB:
CONNECT aud_admin@hrpdb
Enter password: password Copy
Connected.
BEGIN
DBMS_AUDIT_MGMT.SET_PURGE_JOB_STATUS(
AUDIT_TRAIL_PURGE_NAME => 'Audit_Trail_PJ',
AUDIT_TRAIL_STATUS_VALUE => DBMS_AUDIT_MGMT.PURGE_JOB_EN
END;
/
In this example:
28.3.5.2 Setting the Default Audit Trail Purge Job Interval for a Specified Purge
Job
You can set a default purge operation interval, in hours, that must pass before the next purge
job operation takes place.
To set the default audit trail purge job interval for a specific purge job, run the
DBMS_AUDIT_MGMT.SET_PURGE_JOB_INTERVAL procedure.
For example, assuming that you had created the purge job in the hrpdb PDB:
CONNECT aud_admin@hrpdb
Enter password: password Copy
Connected.
BEGIN
DBMS_AUDIT_MGMT.SET_PURGE_JOB_INTERVAL(
AUDIT_TRAIL_PURGE_NAME => 'Audit_Trail_PJ',
AUDIT_TRAIL_INTERVAL_VALUE => 24);
END;
/
In this example:
AUDIT_TRAIL_PURGE_NAME specifies the name of the audit trail purge job. To find
a list of existing purge jobs, query the JOB_NAME and JOB_STATUS columns of the
DBA_AUDIT_MGMT_CLEANUP_JOBS data dictionary view.
To find existing purge jobs, query the JOB_NAME and JOB_STATUS columns of the
DBA_AUDIT_MGMT_CLEANUP_JOBS data dictionary view.
For example, assuming that you had created the purge job in the hrpdb PDB:
CONNECT aud_admin@hrpdb
Enter password: password Copy
Connected.
BEGIN
DBMS_AUDIT_MGMT.DROP_PURGE_JOB(
AUDIT_TRAIL_PURGE_NAME => 'Audit_Trail_PJ');
END;
/
To find a history of audit trail log cleanup, you can query the UNIFIED_AUDIT_TRAIL data
dictionary view, using the following criteria: OBJECT_NAME is DBMS_AUDIT_MGMT,
OBJECT_SCHEMA is SYS, and SQL_TEXT is set to LIKE
%DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL%.
CONNECT aud_admin@hrpdb
Enter password: password Copy
Connected.
BEGIN
DBMS_AUDIT_MGMT.CLEAR_LAST_ARCHIVE_TIMESTAMP(
AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFI
CONTAINER => DBMS_AUDIT_MGMT.CONTAINER_CURRENT
END;
/
In this example:
AUDIT_TRAIL_TYPE is set for the unified audit trail. If the AUDIT_TRAIL_TYPE
property is set to DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS or
DBMS_AUDIT_MGMT.AUDIT_TRAIL_XML, then you cannot set
RAC_INSTANCE_NUMBER to 0. You can omit the RAC_INSTANCE_NUMBER setting if
you set AUDIT_TRAIL_TYPE to DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED.
You can clear the archive timestamps from the AUDSYS.AUD$UNIFIED table by
setting DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED_TABLE. To clear the archive
timestamps from the operating system spillover files in each database (primary or
standby), set DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED_FILES.
The pseudo code in Example 28-1 creates a database audit trail purge operation that the user
calls by invoking the DBMS_ADUIT.CLEAN_AUDIT_TRAIL procedure for the unified audit trail.
The purge operation deletes records that were created before the last archived timestamp by
using a loop. The loop archives the audit records, calculates which audit records were archived
and uses the SetCleanUpAuditTrail call to set the last archive timestamp, and then calls
the CLEAN_AUDIT_TRAIL procedure. In this example, major steps are in bold typeface.
CALL SetCleanUpAuditTrail();
IF(/* Clean up is needed immediately */)
DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(
AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED
USE_LAST_ARCH_TIMESTAMP => TRUE,
CONTAINER => DBMS_AUDIT_MGMT.CONTAINER_CURRENT )
END IF
END LOOP /*LOOP*/
END; /* PROCEDURE */
/
Table 28-2 Views That Display Information about Audit Trail Management Settings
View Description
DBA_AUDIT_MGMT_CLEAN_EVENTS Displays the history of purge events of the traditional (that is,
non-unified) audit trails. Periodically, as a user who has been
granted the AUDIT_ADMIN role, you should delete the contents
of this view so that it does not grow too large. For example:
© Oracle About Oracle Contact Us Products A-Z Terms of Use & Privacy Cookie Preferences Ad Choices
DBA_AUDIT_MGMT_CONFIG_PARAMS Displays the currently configured audit trail properties that are
used by the DBMS_AUDIT_MGMT PL/SQL package
DBA_AUDIT_MGMT_LAST_ARCH_TS Displays the last archive timestamps that have set for audit trail
purges
Related Topics