I am on Oracle 9.2. My actual goal is to trace certain SCHEMA.
In the script below, both insert and execute immediate do not work, independently or together. The Schema name is TEST.
Am I missing something? Test has DBA Privs. Also there is some thing more that is happening. When I put any line in the trigger (any valid line at all) except NULL, I get a trace file for about 700 bytes. But further actions in the same session are not getting recorded in the Trace File.
CREATE OR REPLACE TRIGGER TEST.TEST_TRIGGER
AFTER LOGON
ON TEST.SCHEMA
DECLARE
tmpVar NUMBER;
BEGIN
EXECUTE IMMEDIATE 'ALTER SESSION SET SQL_TRACE=TRUE';
-- and/or
INSERT INTO testtab VALUES (1010);
COMMIT;
END;
Originally posted by slimdave I believe that logon triggers do not fire for DBA users.
Logon triggers do fire for DBA users (they don't fire only for users that connect AS SYSDBA/SYOPER). However for DBA users, they simply ignore any possible failure that might occure during execution of the logon trigger. In other words, if something fails inside the trigger, the non-DBA users are prevented from loging in to the database, while DBA users are not.
Patnams, I belive you have to use authonomous transaction for that kind of operations inside your trigger - put "PRAGMA AUTOMOMOUS_TRANSACTION;" inside your DECLARATION section.
Jurij Modic ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
I just used this format of trigger (see script below) and it works, but the earlier question still remains. I was looking on AskTom, some one got it working by "compiling the trigger from a schema that has Create Any Trigger and other privileges but NOT DBA role".
I tried and it did not work.
this one works though,
CREATE OR REPLACE TRIGGER TEST.trace_test
AFTER LOGON
ON DATABASE WHEN (USER='TEST')
..
..
Bookmarks