oracle查看某session ip

  1. 先创建个触发器获取ip
create or replace trigger on_logon_trigger
after logon on database
begin
    dbms_application_info.set_client_info(sys_context( 'userenv', 'ip_address' ) );
end;
  1. 可以使用下方语句查看session的ip
select /*+ PARALLEL(4) */ a.inst_id,                                                                        
        a.sid,                                                                            
        a.schemaname,                                                                     
        a.machine,                                                                        
        a.program,     
        a.client_info,                                                                   
        b.INSTANCE_NAME || '_ora_' || c.SPID || '.trc' file_name  ,                    
        D.VALUE  file_path                                                                
   from  gv$session a, gV$instance b, gv$process c, gv$system_parameter d                  
  where a.inst_id = b.inst_id                                                             
    and a.inst_id = c.INST_ID                                                             
    and a.PADDR = c.ADDR                                                                  
    and a.INST_ID = d.INST_ID       
    and sid=
posted @ 2024-02-21 15:08  by1314  阅读(84)  评论(0编辑  收藏  举报
浏览器标题切换
浏览器标题切换end