Tag Archives: SQL query running

Get the Client connected connection information in Oracle

Check the client connection info in oracle

Following commands give you the detail of client connection:

Check the session connect info:

select * from V$session_connect_info;

Check number of session both active and inactive

select * from v$sessions;

Check session with module name and client info in V$session

column username format a15 word_wrapped
column module format a15 word_wrapped
column action format a15 word_wrapped
column client_info format a30 word_wrapped

select username||'('||sid||','||serial#||')' username,
module,
action,
client_info
from v$session
where module||action||client_info is not null;

Check user session status with machine, server name, user, osuser, process id , session id in Oracle

select
       substr(a.spid,1,9) pid,
       substr(b.sid,1,5) sid,
       substr(b.serial#,1,5) ser#,
       substr(b.machine,1,6) box,
       substr(b.username,1,5) username,
--       b.server,
       substr(b.osuser,1,8) os_user,
       substr(b.program,1,30) program,
        substr(b.status,1,10) status
from v$session b, v$process a
where
b.paddr = a.addr
and type='USER'
order by spid;

Find SQL query running from session by client

set pagesize 100 linesize 132
col username format a10
col sql_text format a60
SELECT USERname,terminal,SID,a.module,
SERIAL#,SQL_TEXT
FROM V$SESSION a, V$SQL b
WHERE a.SQL_ADDRESS = b.ADDRESS and UPPER(program)  LIKE '%W3%'
--AND a.STATUS = 'ACTIVE'
--AND SQL_TEXT not like '%USERname%'
AND username IS NOT NULL;