标签:select inf text session code bms cat replace create
我们都知道在v$session中记录着客户端的机器名称,但是没有IP,那我们如何让v$session中也记录IP的信息呢?BEGIN
DBMS_SESSION.set_identifier(SYS_CONTEXT(‘USERENV‘, ‘IP_ADDRESS‘));
END;
/
create or replace trigger on_logon_trigger
after logon ondatabase
begin
dbms_application_info.set_client_info(sys_context(‘userenv‘,‘ip_address‘));
end;
/
注:执行过程包和触发器需要dba权限
执行查询sql:
select username,
program,
machine,
client_info,
sys_context(‘userenv‘, ‘ip_address‘) as ipadd
from v$session s
where username is not null
order by username, program, machine;
标签:select inf text session code bms cat replace create
原文地址:http://blog.51cto.com/996665552/2321975