Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: trace via logon trigger
I don't like to use a wider scope than necessary to solve a problem, i.e.
use a "logon on database" trigger when a "logon on schema" is sufficient.
Limit potential damage to the smallest possible exposure.
This works for me:
SQL> create user kpayton identified by kpayton;
User created.
SQL> create or replace trigger kpayton.logon_trigger
2 after logon on kpayton.schema
3 begin
4 execute immediate 'alter session set events ''10046 trace name
context forever, level 4''';
5 exception
6 when others then null;
7 end;
8 /
Trigger created.
SQL> show errors
No errors.
SQL>
PS. Just because it works outside the trigger doesn't mean it will work
inside the trigger. User kpayton needs the "alter session" privilege
granted explicitly and directly.
At 07:58 AM 5/13/2004, you wrote:
>This should work...
>create or replace trigger set_system_event
>after logon on database
>declare
>v_user dba_users.username%TYPE:=user;
>sql_stmt1 varchar2(256) :='alter session set events '||chr(39)||'10046
>trace name context forever, level 12'||ch
>r(39);
>begin
> if (v_user='XXXX') THEN
> execute immediate sql_stmt1;
> end if;
>end;
>/
regards
Wolfgang Breitling
Centrex Consulting Corporation
www.centrexcc.com
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Thu May 13 2004 - 09:44:52 CDT
![]() |
![]() |