I would like to audit specific procedure for specific user. For example i have a stored procedure prc_user_error and i have user which name of Ktd. When the Ktd user execute prc_user_error procedure should be audited.
I cant use trigger. Also fine grained auditing cant use for execute. Can you please help me ?
Thanks,
CodePudding user response:
IDK how you want to audit it, but assume to insert a record into some table:
create table myAudit( auditTime TIMESTAMP, auditUser VARCHAR2(30));
in procedure:
insert into myAudit values (SYSTIMESTAMP, SYS_CONTEXT ('USERENV','SESSION_USER') );
CodePudding user response:
How about setting up your procedure like this and test for the name(s) and exit without doing anything in your procedure. If coded correctly than nothing should be printed in my example
create or replace procedure sp as
v_user varchar2(32) := SYS_CONTEXT( 'USERENV', 'SESSION_USER' );
begin dbms_output.put_line(v_user);
end;
/
begin
sp;
end;