Auditing Enhancements in Oracle Database 19c
This article gives an overview of the auditing enhancements in Oracle database 19c.
oracle 19cconfigurationintermediate
by OracleDba
47 views
This article gives an overview of the auditing enhancements in Oracle database 19c.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
conn sys/SysPassword1@//localhost:1521/pdb1 as sysdba
exec dbms_audit_mgmt.clean_audit_trail(dbms_audit_mgmt.audit_trail_unified,false);
-- drop user testuser1 cascade;
create user testuser1 identified by testuser1 quota unlimited on users;
grant connect, resource to testuser1;
grant select_catalog_role to testuser1;
create table testuser1.t1 (
id number
);
create or replace procedure testuser1.insert_t1 (p_id in number)
as
begin
insert into t1 values (p_id);
end;
/
create audit policy testuser1_pol
actions all
when q'~ sys_context('userenv', 'session_user') = 'TESTUSER1' ~'
evaluate per session;
create audit policy testuser1_toplevel_pol
actions all
when q'~ sys_context('userenv', 'session_user') = 'TESTUSER1' ~'
evaluate per session
only toplevel
;
audit policy testuser1_pol;
conn testuser1/testuser1@//localhost:1521/pdb1
exec insert_t1(1);
commit;
conn sys/SysPassword1@//localhost:1521/pdb1 as sysdba
set linesize 200
column event_timestamp format a30
column action_name format a13
column object_schema format a15
column object_name format a25
select event_timestamp,
action_name,
object_schema,
object_name
from unified_audit_trail
where dbusername = 'TESTUSER1'
order by event_timestamp;
EVENT_TIMESTAMP ACTION_NAME OBJECT_SCHEMA OBJECT_NAME
------------------------------ ------------- --------------- -------------------------
09-JAN-22 02.52.41.856739 PM LOGON
09-JAN-22 02.52.41.864478 PM ALTER SESSION
09-JAN-22 02.52.41.870481 PM SELECT SYS DUAL
09-JAN-22 02.52.41.876372 PM EXECUTE SYS DBMS_APPLICATION_INFO
09-JAN-22 02.52.41.881929 PM COMMIT
09-JAN-22 02.52.41.886135 PM COMMIT
09-JAN-22 02.52.41.889243 PM INSERT TESTUSER1 T1
09-JAN-22 02.52.41.890034 PM EXECUTE TESTUSER1 INSERT_T1
09-JAN-22 02.52.41.890959 PM COMMIT
09-JAN-22 02.52.53.693288 PM LOGOFF
10 rows selected.
SQL>
noaudit policy testuser1_pol;
audit policy testuser1_toplevel_pol;
exec dbms_audit_mgmt.clean_audit_trail(dbms_audit_mgmt.audit_trail_unified,false);
conn testuser1/testuser1@//localhost:1521/pdb1
exec insert_t1(1);
commit;
conn sys/SysPassword1@//localhost:1521/pdb1 as sysdba
set linesize 200
column event_timestamp format a30
column action_name format a13
column object_schema format a15
column object_name format a25
select event_timestamp,
action_name,
object_schema,
object_name
from unified_audit_trail
where dbusername = 'TESTUSER1'
order by event_timestamp;
EVENT_TIMESTAMP ACTION_NAME OBJECT_SCHEMA OBJECT_NAME
------------------------------ ------------- --------------- -------------------------
09-JAN-22 02.56.18.545875 PM LOGON
09-JAN-22 02.56.18.556143 PM SELECT SYS DUAL
09-JAN-22 02.56.18.561399 PM EXECUTE SYS DBMS_APPLICATION_INFO
09-JAN-22 02.56.18.566822 PM COMMIT
09-JAN-22 02.56.18.572013 PM COMMIT
09-JAN-22 02.56.18.575647 PM EXECUTE TESTUSER1 INSERT_T1
09-JAN-22 02.56.18.576603 PM COMMIT
09-JAN-22 02.56.23.354887 PM LOGOFF
8 rows selected.
SQL>
noaudit policy testuser1_pol
noaudit policy testuser1_toplevel_pol;
drop audit policy testuser1_pol;
drop audit policy testuser1_toplevel_pol;12
cd $ORACLE_HOME/ahf/oracle.ahf/bin
./tfactl diagcollect -srdc dbaudit123456789101112131415161718192021222324252627282930
Windows
UNIFIED_AUDIT_SYSTEMLOG = { TRUE | FALSE }
UNIX
UNIFIED_AUDIT_SYSTEMLOG = 'facility_clause.priority_clause'
UNIFIED_AUDIT_COMMON_SYSTEMLOG = 'facility_clause.priority_clause'
facility_clause ::= { USER | LOCAL[ 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 ] }
priority_clause::= { NOTICE | INFO | DEBUG | WARNING | ERR | CRIT | ALERT | EMERG }
cat >> /etc/rsyslog.conf <<EOF
local0.notice /var/log/local0.notice.audit.log
EOF
systemctl restart syslog
conn / as sysdba
alter system set unified_audit_common_systemlog='local0.notice' scope=spfile;
shutdown immediate;
startup;
conn / as sysdba
alter session set container=pdb1;
alter system set unified_audit_systemlog='local0.notice' scope=spfile;
shutdown immediate;
startup;Please to add comments
No comments yet. Be the first to comment!