(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
This lesson focuses on techniques 1, 2 and 3
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
Capture audit records in SYS.AUD$
SQL> alter system
2 set audit_trail=db
3 scope=spfile;
System altered.
Audit activity by SYSDBA connections too
SQL> alter system
2 set audit_sys_operations=true
3 scope=spfile;
System altered.
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
Wed Apr 7 10:30:11 2004
ACTION : 'drop tablespace test including contents an
DATABASE USER: 'system'
PRIVILEGE : SYSDBA
CLIENT USER: suzanne
CLIENT TERMINAL: SUZANNE
STATUS: 0
User dropped tablespace at 10:30 AM
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
Do the mini-workshop
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SQL> audit table;
Audit succeeded.
SQL> audit drop any table;
Audit succeeded.
SQL> audit all on scott.emp;
Audit succeeded.
Audit all create, drop, truncate table
SQL> audit all;
Audit succeeded.
SQL> noaudit select on scott.emp;
Noaudit succeeded.
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SQL> audit session;
Audit succeeded.
SQL> select user_name, audit_option, success, failure
2 from dba_stmt_audit_opts;
USER_NAME AUDIT_OPTION SUCCESS FAILURE
---------- --------------- ---------- ----------
CREATE SESSION BY ACCESS BY ACCESS
(If applicable)



Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SQL> AUDIT SYSTEM GRANT;
Audit succeeded.
SQL> GRANT ALTER USER TO dave;
This statement is now captured in the audit trail
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SQL> SELECT username, action_name, sys_privilege, grantee,
2 DECODE(returncode, '0', 'Granted' , returncode ) code,
3 TO_CHAR(timestamp, 'mm/dd/yy hh24:mi') time
4 FROM dba_audit_statement;
USERNAME ACTION_NAME SYS_PRIVILEGE GRANTEE RESULT TIME
----------- ------------ -------------- ------- ------- --------------
DAVE SYSTEM GRANT ALTER USER SCOTT 1031 10/14/03 16:11
SYSTEM SYSTEM GRANT ALTER USER DAVE Granted 10/14/03 16:13
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SQL> audit update, delete, insert on scott.emp;
Audit succeeded.
SQL> audit select on scott.emp by access whenever successful;
Audit succeeded.
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SQL> select * from dba_obj_audit_opts
2 where owner='SCOTT'
3 and object_name='EMP';
ALT AUD COM DEL GRA IND INS LOC REN SEL UPD REF EXE CRE REA WRI
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
-/- -/- -/- S/S -/- -/- S/S -/- -/- A/- S/S -/- -/- -/- -/- -/-
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SQL> select username, obj_name,
2 action_name, ses_actions,
3 to_char(timestamp, 'mm/dd/yy hh24:mi:ss') time
4 from dba_audit_object
5 where owner = 'SCOTT'
6 order by time;
USERNAME OBJ_NAME ACTION_NAME SES_ACTIONS TIME
--------- ---------- ------------ ------------------ --------------
DAVE EMP SELECT 04/06/04 15:32:49
DAVE EMP SESSION REC ------F--------- 04/06/04 15:33:29
GARY EMP SELECT 04/06/04 15:34:06
GARY EMP SESSION REC ---F------S----- 04/06/04 15:34:15
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)

Other Text:
(Examples or comments displayed on slide, if any).
CREATE TABLE audit_history_emp
(emp_no NUMBER, name VARCHAR2(30), old_salary NUMBER,
new_salary NUMBER, change_date DATE, changer VARCHAR2(30) );
CREATE TRIGGER emp_audit AFTER UPDATE OR INSERT ON emp
FOR EACH ROW
BEGIN
IF UPDATING THEN
INSERT INTO audit_history_emp
VALUES(:old.emp_no , :old.name , :