Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Audit Current logged in User activity

karthiksingh_dbaJan 28 2014 — edited Jan 28 2014

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

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 25 2014
Added on Jan 28 2014
15 comments
1,356 views