Here is the simple query, showing who is connected to the server.
col username for a15
col program for a25 trun
select sid, serial#, username, program, substr(module,1,10) module, logon_time
from v$session
order by 1,2;
This is almost the same query, limiting the output to the active users:
select sid, serial#, username, program, substr(module,1,10) module, logon_time
from v$session
where status = 'ACTIVE'
order by 1,2;
It’s important to set “MODULE” field for the running sessions. It makes the output more clear.
The setting could be done with the following command:
exec DBMS_APPLICATION_INFO.SET_MODULE( module_name=>'&module',action_name=>'&action' );