时间:2021-07-01 10:21:17 帮助过:3人阅读
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;
Oracle记录连接用户IP地址的方法
标签:select inf text session code bms cat replace create