вторник, 12 августа 2008 г.

Выполнение настроек сессии - after_logon_trigger

create or replace trigger bkw$_after_logon_on_database
after logon on database
declare
-- Target parameters:
l_tracefile_id      varchar(100);
l_event             varchar(100);

l_target_username   varchar(100);
l_targer_ip_address varchar(100);


-- Current Parameters:
l_cur_username   varchar(100);
l_cur_ip_address varchar(100);
begin
--
-- Setup Target parameters:
--
l_tracefile_id      := 'BKW_TRACE_001';
l_event             := '10046 trace name context forever,level 12';

l_target_username   := '';
l_targer_ip_address := '';


--
-- Read current parameters From Syscontext:
--

-- Username:
select sys_context('USERENV','SESSION_USER') into l_cur_username from dual;

-- Client IP:
select sys_context('USERENV','IP_ADDRESS')  into l_cur_ip_address from dual;


--
-- Check Conditions:
--
if (l_cur_username=l_target_username) and (l_cur_ip_address=l_targer_ip_address) then
execute immediate 'alter session set max_dump_file_size = UNLIMITED';
execute immediate 'alter session set tracefile_identifier='||l_tracefile_id;
execute immediate 'alter session set events=''||l_event||''';
end if;
exception
when others then
null;
end;
/

Комментариев нет: