Tuesday, December 22, 2015

Automate Database OS Audit File Cleanup

Using EM12c corrective action of type SQL Script you can automate the cleanup of the database OS audit file that are created in the adump directory.

If you want details on how to create and deploy corrective action use my blog post here


Below is the script that can be used in the SQL Script corrective action to delete anything older then sysdate-1 in the adump directory

WHENEVER SQLERROR EXIT FAILURE;
BEGIN
DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP(
   audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS,
   last_archive_time => SYSDATE-1);
END;
/

BEGIN
DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(
   audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS);
END;
/


The metric that monitors the adump size of audit file is below so you can add the corrective action to the metric.

3 comments:

  1. Thank you for sharing this post.

    ReplyDelete
  2. www.veiligbackuppen.nl master in giving in great and best quality for Online backup,Cloud reinforcement, Cloud backup, Nas reinforcement, reinforcements maken and Online opslag.

    ReplyDelete
  3. Take a short look on next Generation high performance Cloud Servers, keep visiting zolute.

    ReplyDelete