oracle 查询 主机名和对应的IP地址

--查询对应的IP地址

select count(1), machine, a.CLIENT_INFO   from v$session a  group by machine, CLIENT_INFO;

--查询对应的主机名、IP地址

select distinct w.machine, a.CLIENT_INFO   from DBA_HIST_ACTIVE_SESS_HISTORY w, v$session a  where w.sql_exec_start >= sysdate - 30   

--and w.machine not in ('db2','db1')   

and a.MACHINE = w.machine

---或者    select distinct w.machine, a.CLIENT_INFO   from v$active_session_history w, v$session a  where w.sql_exec_start >= sysdate - 30   

--and w.machine not in ('db2','db1')   

and a.MACHINE = w.machine

猜你喜欢

转载自www.cnblogs.com/ss-33/p/8986837.html