DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Tuesday, June 28, 2016

Enable trace whenever user logged into DB


We can accomplish this by creating a trigger.

Please note that you disable this trigger after you done with your activity. Else it will fill up user dump destination,

Script :

create or replace trigger set_trace after logon on database
begin
if user  in ('SCOTT') then
execute immediate
'Alter session set events ''10046 trace name context forever, level 12''';
execute immediate
'Alter session set timed_statistics=true';
execute immediate
'Alter session set statistics_level=typical';
execute immediate
'Alter session set tracefile_identifier=''TEST1_trace''';
execute immediate 'alter session set max_dump_file_size=unlimited';
end if;
exception
when others then
null;
end;
/


No comments: