The auditing feature can be used to audit operations performed by specified users.
Audit successful DDL operations performed on all tables by a specified user
Log in as the
ORAAUDITORuser and enable auditing for all successful DDL operations performed byuser1on tables.obclient> AUDIT TABLE BY user1 WHENEVER SUCCESSFUL;View auditing records for successful operations performed by
user1in theDBA_AUDIT_TRAILtable.obclient> SELECT USERNAME,USERHOST,TIMESTAMP,SQL_TEXT FROM SYS.DBA_AUDIT_TRAIL WHERE USERNAME = 'USER1'; +----------+----------------+-----------+--------------------------------------+ | USERNAME | USERHOST | TIMESTAMP | SQL_TEXT | +----------+----------------+-----------+--------------------------------------+ | USER1 | 100.10.10.10 | 23-DEC-21 | create table tbl1(col1 int,col2 int) | | USER1 | 100.10.10.10 | 23-DEC-21 | DROP TABLE tbl1 | +----------+----------------+-----------+--------------------------------------+ 2 rows in set
Audit all operations of a specified user, including login and logout
Log in as the
ORAAUDITORuser and enable auditing for all operations performed byuser1.obclient> AUDIT ALL STATEMENTS BY user1;View auditing records for
user1in theDBA_AUDIT_TRAILtable.obclient> SELECT USERNAME,USERHOST,TIMESTAMP,SQL_TEXT FROM SYS.DBA_AUDIT_TRAIL WHERE USERNAME = 'USER1'; +----------+----------------+-----------+--------------------------------------+ | USERNAME | USERHOST | TIMESTAMP | SQL_TEXT | +----------+----------------+-----------+--------------------------------------+ | USER1 | 100.10.10.10 | 22-DEC-21 | CONNECT | | USER1 | 100.10.10.10 | 23-DEC-21 | DISCONNECT | | USER1 | 100.10.10.10 | 23-DEC-21 | CONNECT | | USER1 | 100.10.10.10 | 23-DEC-21 | create table tbl1(col1 int,col2 int) | | USER1 | 100.10.10.10 | 23-DEC-21 | DROP TABLE tbl1 | | USER1 | 100.10.10.10 | 23-DEC-21 | GRANT CREATE SESSION TO user2 | | USER1 | 100.10.10.10 | 23-DEC-21 | CREATE ROLE role1 | | USER1 | 100.10.10.10 | 23-DEC-21 | DROP ROLE role1 | +----------+----------------+-----------+--------------------------------------+ 8 rows in set
References
For more information about security auditing, see: