Oracle - Audit Trail for a specific user

只愿长相守 提交于 2019-12-23 17:31:38

问题


As stated on the topic , I am looking for a way for us to track on the activities of the specific user. May or may not have the SYSDBA or SYSOPER privilege.

For example , HR.

I would like to know what are the details of his login , what are the objects that are changed by him , what were their original values , SQL statements executed , what procedure/functions that were executed etc.

Could we set up such audit trail log in Oracle 11gR2 Standard/Enterprise?

Thanks


回答1:


First of all you need to enable auditing in your database by setting audit_trail parameter as shown below-

SQL> alter system set audit_trail='OS|DB|DB,EXTENDED|XML|XML, EXTENDED';

Initialization Parameters Used for Auditing

Then, you can audit user as-

SQL>CONNECT sys/password AS SYSDBA

SQL> AUDIT ALL BY username BY ACCESS;
SQL> AUDIT SELECT TABLE, UPDATE TABLE, INSERT TABLE, DELETE TABLE BY username BY ACCESS;
SQL> AUDIT EXECUTE PROCEDURE BY username BY ACCESS;

AUDIT

Audit records can be found in DBA_AUDIT_TRAIL view.Following query list all audit related views.

SQL>SELECT view_name FROM dba_views WHERE view_name LIKE 'DBA%AUDIT%';

Fine-grained auditing is available in Enterprise Edition only.

Feature Availability by Edition



来源:https://stackoverflow.com/questions/41976094/oracle-audit-trail-for-a-specific-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!