dbTalk Databases Forums  

Oracle Auditing by User

comp.databases.oracle.server comp.databases.oracle.server


Discuss Oracle Auditing by User in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
indytoatl
 
Posts: n/a

Default Oracle Auditing by User - 04-22-2011 , 08:36 PM






I am trying to audit select statements on a column for everyone except
JohnDoe who works in the HR dept. How do I create the correct
audit_condition??


BEGIN
DBMS_FGA.ADD_POLICY(
object_schema => 'HR'
,object_name => 'EMPLOYEES'
,policy_name => 'PAYROLL_INFO'
,audit_condition => 'DBUser NOT = 'JohnDoe'
,audit_column => 'SALARY'
,handler_schema => NULL
,handler_module => NULL
,enable => TRUE
,statement_types => 'SELECT'
,audit_trail => DBMS_FGA.DB_EXTENDED
,audit_column_opts => DBMS_FGA.ANY_COLUMNS
);
END;
/

Reply With Quote
  #2  
Old   
onedbguru
 
Posts: n/a

Default Re: Oracle Auditing by User - 04-23-2011 , 11:37 AM






On Apr 22, 9:36*pm, indytoatl <indyto... (AT) gmail (DOT) com> wrote:
Quote:
I am trying to audit select statements on a column for everyone except
JohnDoe who works in the HR dept. How do I create the correct
audit_condition??

BEGIN
* * DBMS_FGA.ADD_POLICY(
* * * * *object_schema => 'HR'
* * * * ,object_name => 'EMPLOYEES'
* * * * ,policy_name => 'PAYROLL_INFO'
* * * * ,audit_condition => 'DBUser NOT = 'JohnDoe'
* * * * ,audit_column => 'SALARY'
* * * * ,handler_schema => NULL
* * * * ,handler_module => NULL
* * * * ,enable => TRUE
* * * * ,statement_types => 'SELECT'
* * * * ,audit_trail => DBMS_FGA.DB_EXTENDED
* * * * ,audit_column_opts => DBMS_FGA.ANY_COLUMNS
* * );
END;
/
,audit_condition => 'sys_Context(''USERENV'',''SESSION_USER'') <> ''
JOHNDOE'' '

I don't have a system to test it on at the moment... notice the
double single-quotes...

Reply With Quote
  #3  
Old   
BicycleRepairman
 
Posts: n/a

Default Re: Oracle Auditing by User - 04-23-2011 , 12:20 PM



On Apr 22, 9:36*pm, indytoatl <indyto... (AT) gmail (DOT) com> wrote:
Quote:
I am trying to audit select statements on a column for everyone except
JohnDoe who works in the HR dept. How do I create the correct
audit_condition??

BEGIN
* * DBMS_FGA.ADD_POLICY(
* * * * *object_schema => 'HR'
* * * * ,object_name => 'EMPLOYEES'
* * * * ,policy_name => 'PAYROLL_INFO'
* * * * ,audit_condition => 'DBUser NOT = 'JohnDoe'
* * * * ,audit_column => 'SALARY'
* * * * ,handler_schema => NULL
* * * * ,handler_module => NULL
* * * * ,enable => TRUE
* * * * ,statement_types => 'SELECT'
* * * * ,audit_trail => DBMS_FGA.DB_EXTENDED
* * * * ,audit_column_opts => DBMS_FGA.ANY_COLUMNS
* * );
END;
/
,audit_condition => 'sys_context(''userenv'',''session_user'') !=
''JOHNDOE'''

should get you what you want (or substitute any of the other
identifiers in the sys_context if needed).

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.