Skip to content

trace trigger

trace trigger published on Комментариев к записи trace trigger нет

grant execute on dbms_monitor to some_user

db username:

CREATE OR REPLACE TRIGGER trace_some_user
AFTER LOGON ON some_user.SCHEMA
BEGIN
        execute immediate 'alter session set timed_statistics = true';
      execute immediate 'alter session set max_dump_file_size = unlimited';
      execute immediate 'alter session set tracefile_identifier = ''some_user''';
      dbms_monitor.session_trace_enable (null,null,true,true);
END;

Os username:

CREATE OR REPLACE TRIGGER trace_some_user
AFTER LOGON ON database
declare
v_user varchar2(100);
begin
SELECT SYS_CONTEXT ('USERENV', 'OS_USER') into v_user from dual;

if v_user='some_user' then
  execute immediate 'alter session set timed_statistics = true';
      execute immediate 'alter session set max_dump_file_size = unlimited';
      execute immediate 'alter session set tracefile_identifier = ''some_user''';
      dbms_monitor.session_trace_enable (null,null,true,true);
end if;

END;

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *

Primary Sidebar

Яндекс.Метрика