Dear Legends,
As I am trying out to find who are all logged in to our Database and what are queries executed by the users. So while trying out the below query
QUERY
SELECT DISTINCT
USERNAME,
STATUS,
SCHEMANAME,
OSUSER,
MACHINE,
TO_CHAR(AR.LAST_LOAD_TIME, 'DD-Mon-YYYY HH24:MM:SS') LOAD_TIME,
ss.WAIT_CLASS,
ss.SECONDS_IN_WAIT,
ss.STATE,
ar.sql_text SQLTEXT
FROM
v$session ss,
v$sqlarea ar
WHERE
ss.MACHINE NOT LIKE 'ip%'
AND ss.STATUS = 'ACTIVE'
AND ss.SQL_ADDRESS = ar.ADDRESS;
The Issue is when I execute the above query it returns a valid output that I'm logged in from a machine and it's client as SQL DEVELOPER. But I'm not able to view the same queries output in SQLPLUS.... I have scheduled this into a cron so I need SQLPLUS to work this query.
Do you know why? Let me know your suggestions.
Note: I need this condition "ss.MACHINE NOT LIKE 'ip%'" if not it will fetch the hosted servers machine and user.
Thanks,
Karthik