databaseauditing
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| databaseauditing [2015/07/08 15:23] – created z0hpvk | databaseauditing [2025/03/08 22:24] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ==== Database Auditing ==== | + | ===== Database |
| + | ==== Disabling Create Session | ||
| - | By default when a database is created using DBCA, the database auditing parameter will be turned on. | + | By default, from 11gR1, |
| < | < | ||
| Line 8: | Line 9: | ||
| ------------------------------------ ----------- ------------------------------ | ------------------------------------ ----------- ------------------------------ | ||
| audit_trail | audit_trail | ||
| - | This means whenever a connection is made to the database, an entry is logged in the Audit Trail. | + | This means whenever a connection is made to the database, an entry is logged in the Audit Trail.\\ |
| Therefore the table sys.aud$ can grow very quickly and on web applications will affect performance | Therefore the table sys.aud$ can grow very quickly and on web applications will affect performance | ||
| Line 16: | Line 17: | ||
| Noaudit succeeded.</ | Noaudit succeeded.</ | ||
| - | This still means that failed logins are audited. | + | This still means that failed logins are audited. |
| + | |||
| + | ==== Viewing Audit Trail ==== | ||
| + | |||
| + | SQL below will show everything that has been audited today | ||
| + | |||
| + | < | ||
| + | set linesize 160 | ||
| + | col os_username format a15 | ||
| + | col userhost format a45 | ||
| + | |||
| + | select os_username, | ||
| + | from dba_audit_trail | ||
| + | where timestamp > trunc(sysdate) | ||
| + | order by timestamp;</ | ||
| + | |||
| + | ==== Purging Audit Trail ==== | ||
| + | Copy sys.aud$ table to the SYSAUX tablespace | ||
| + | < | ||
| + | DBMS_AUDIT_MGMT.INIT_CLEANUP( | ||
| + | AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD, | ||
| + | DEFAULT_CLEANUP_INTERVAL => 24 | ||
| + | ); | ||
| + | END; | ||
| + | /</ | ||
| + | |||
| + | Create a job to set the Archive Timestamp. In this case it will be over 30 days | ||
| + | < | ||
| + | DBMS_SCHEDULER.CREATE_JOB ( | ||
| + | job_name | ||
| + | job_type | ||
| + | job_action => 'BEGIN DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP(AUDIT_TRAIL_TYPE => | ||
| + | | ||
| + | start_date => sysdate, | ||
| + | repeat_interval => ' | ||
| + | enabled | ||
| + | comments | ||
| + | ); | ||
| + | END; | ||
| + | /</ | ||
| + | |||
| + | Create a purge job which will delete all audit entries older than the Archive Timestamp. | ||
| + | < | ||
| + | DBMS_AUDIT_MGMT.CREATE_PURGE_JOB( | ||
| + | AUDIT_TRAIL_TYPE | ||
| + | AUDIT_TRAIL_PURGE_INTERVAL => 24 /* hours */, | ||
| + | AUDIT_TRAIL_PURGE_NAME | ||
| + | USE_LAST_ARCH_TIMESTAMP | ||
| + | ); | ||
| + | END; | ||
| + | /</ | ||
databaseauditing.1436369011.txt.gz · Last modified: (external edit)
