Wednesday, December 21, 2011

The number of users connected on the environment at the moment

The below query used to get the number of users connected on the environment at the moment.

   1:  select DISTINCT OPRID,
   2:                  LOGIPADDRESS,
   3:                  TO_CHAR(LOGINDTTM, 'YYYY-MM-DD:hh:mi:ss') LOGINTIME,
   4:                  TO_CHAR(LOGOUTDTTM, 'YYYY-MM-DD:hh:mi:ss') LOGOUTIME,
   5:                  TO_CHAR((sysdate), 'YYYY-MM-DD:hh:mi:ss') CURRTIME
   6:    FROM sysadm.PSACCESSLOG WHERE
   7:   (sysdate) - cast(LOGINDTTM as date)  >= 0
   8:   and cast(LOGOUTDTTM as date) - to_date(sysdate) >= 0
   9:   and LOGOUTDTTM = LOGINDTTM;
 
The information is still not accurate (If the user closes the browser or the connection crash).

0 comments:

Post a Comment