Database Administration (MOSC)

MOSC Banner

12c dbms_audit_mgmt - new twists

edited Oct 21, 2016 5:00AM in Database Administration (MOSC) 12 commentsAnswered

Oracle 12.1.0.2 EE

Oracle Linux 6

For quite some time now, in my 11.2 databases I've been running the following shell script on a daily basis (a lot of housekeeping and reporting cosmetics removed for this post):

sqlplus  -s /nolog << EOF >>$logfileconn / as sysdbaBEGINDBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP(DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD, TRUNC(SYSTIMESTAMP)-$retprd);DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP(DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD, TRUNC(SYSTIMESTAMP)-$retprd);DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP(DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS, TRUNC(SYSTIMESTAMP)-$retprd);DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP(DBMS_AUDIT_MGMT.AUDIT_TRAIL_XML, TRUNC(SYSTIMESTAMP)-$retprd);END;/--prompt Current record count:col audit_recs for 999,999,999select count(*) audit_recs,       min(timestamp) oldest,       max(timestamp) newestfrom dba_audit_trail;--select audit_trail,       to_char(last_archive_ts at local,'dd-Mon-yyyy hh24:mi:ss') LOCAL_TIMEfrom dba_audit_mgmt_last_arch_ts;BEGIN   DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(DBMS_AUDIT_MGMT.AUDIT_TRAIL_ALL, TRUE);END;/--prompt Current record count:col audit_recs for 999,999,999select count(*) audit_recs,       min(timestamp) oldest,       max(timestamp) newestfrom dba_audit_trail;EOF

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center