The trigger looks fine to me
SQL> create or replace
2 trigger TRACE_ALL_LOGINS
3 after logon on SCOTT.schema
4 disable
5 declare
6 l_program varchar2(200);
7 begin
8 select program
9 into l_program
10 from v$session
11 where sid = sys_context('USERENV','SID');
12
13 if l_program like 'sqlplus%' then
14 execute immediate 'alter session set tracefile_identifier = MYUSER';
15 dbms_monitor.SESSION_TRACE_ENABLE(waits=>true);
16 end if;
17 --
18 -- if i dont manage to set the trace, i'll allow the login anyway
19 --
20 exception
21 when others then null;
22 end;
23 /
Trigger created.
the other block was missing a quote and an equals sign
SQL> begin
2 for i in ( select sid, serial#
3 from v$session
4 where username = 'MYUSER'
5 ) loop
6 dbms_monitor.SESSION_TRACE_DISABLE(i.sid, i.serial#);
7 end loop;
8 end;
9 /
PL/SQL procedure successfully completed.
But dude... was that such a big deal?