How to check users session

hi,
I need to check user session like how much cpu a particular user consuming, user's session time and what activity he is doing(i.e. how many sql statement worked on and currently working).

The below query will give you details on :
SID/Serial, Foreground, Shadow, OS User, Ora User, User Module, Status Flags, Tran Active, Login Time, Last Call, Lock/Latch, Latch Spin, Current SQL stmt, Previous SQL stmt, Session Waits, WAITED Locks.
set serveroutput on size 50000
set echo off feed off veri off
accept 1 prompt 'Enter Unix process id: '
DECLARE
  v_sid number;
  s sys.v_$session%ROWTYPE;
  p sys.v_$process%ROWTYPE;
BEGIN
  begin
    select sid into v_sid
    from   sys.v_$process p, sys.v_$session s
    where  p.addr     = s.paddr
      and  (p.spid    = &&1
       or   s.process = '&&1');
  exception
    when no_data_found then
      dbms_output.put_line('Unable to find process id &&1!!!');
      return;
    when others then
      dbms_output.put_line(sqlerrm);
      return;
  end;
  select * into s from sys.v_$session where sid  = v_sid;
  select * into p from sys.v_$process where addr = s.paddr;
  dbms_output.put_line('=====================================================================');
  dbms_output.put_line('SID/Serial  : '|| s.sid||','||s.serial#);
  dbms_output.put_line('Foreground  : '|| 'PID: '||s.process||' - '||s.program);
  dbms_output.put_line('Shadow      : '|| 'PID: '||p.spid||' - '||p.program);
  dbms_output.put_line('Terminal    : '|| s.terminal || '/ ' || p.terminal);
  dbms_output.put_line('OS User     : '|| s.osuser||' on '||s.machine);
  dbms_output.put_line('Ora User    : '|| s.username);
  dbms_output.put_line('User Module : '|| s.module);
  dbms_output.put_line('Status Flags: '|| s.status||' '||s.server||' '||s.type);
  dbms_output.put_line('Tran Active : '|| nvl(s.taddr, 'NONE'));
  dbms_output.put_line('Login Time  : '|| to_char(s.logon_time, 'Dy HH24:MI:SS'));
  dbms_output.put_line('Last Call   : '|| to_char(sysdate-(s.last_call_et/60/60/24), 'Dy HH24:MI:SS') || ' - ' || to_char(s.last_call_et/60, '990.0') || ' min');
  dbms_output.put_line('Lock/ Latch : '|| nvl(s.lockwait, 'NONE')||'/ '||nvl(p.latchwait, 'NONE'));
  dbms_output.put_line('Latch Spin  : '|| nvl(p.latchspin, 'NONE'));
  dbms_output.put_line('Current SQL statement:');
  for c1 in ( select * from sys.v_$sqltext
              where HASH_VALUE = s.sql_hash_value order by piece) loop
    dbms_output.put_line(chr(9)||c1.sql_text);
  end loop;
  dbms_output.put_line('Previous SQL statement:');
  for c1 in ( select * from sys.v_$sqltext
              where HASH_VALUE = s.prev_hash_value order by piece) loop
    dbms_output.put_line(chr(9)||c1.sql_text);
  end loop;
  dbms_output.put_line('Session Waits:');
  for c1 in ( select * from sys.v_$session_wait where sid = s.sid) loop
    dbms_output.put_line(chr(9)||c1.state||': '||c1.event);
  end loop;
--  dbms_output.put_line('Connect Info:');
--  for c1 in ( select * from sys.v_$session_connect_info where sid = s.sid) loop
--    dbms_output.put_line(chr(9)||': '||c1.network_service_banner);
--  end loop;
  dbms_output.put_line('Locks:');
  for c1 in ( select /*+ ordered */
          decode(l.type,
          -- Long locks
                      'TM', 'DML/DATA ENQ',   'TX', 'TRANSAC ENQ',
                      'UL', 'PLS USR LOCK',
          -- Short locks
                      'BL', 'BUF HASH TBL',  'CF', 'CONTROL FILE',
                      'CI', 'CROSS INST F',  'DF', 'DATA FILE   ',
                      'CU', 'CURSOR BIND ',
                      'DL', 'DIRECT LOAD ',  'DM', 'MOUNT/STRTUP',
                      'DR', 'RECO LOCK   ',  'DX', 'DISTRIB TRAN',
                      'FS', 'FILE SET    ',  'IN', 'INSTANCE NUM',
                      'FI', 'SGA OPN FILE',
                      'IR', 'INSTCE RECVR',  'IS', 'GET STATE   ',
                      'IV', 'LIBCACHE INV',  'KK', 'LOG SW KICK ',
                      'LS', 'LOG SWITCH  ',
                      'MM', 'MOUNT DEF   ',  'MR', 'MEDIA RECVRY',
                      'PF', 'PWFILE ENQ  ',  'PR', 'PROCESS STRT',
                      'RT', 'REDO THREAD ',  'SC', 'SCN ENQ     ',
                      'RW', 'ROW WAIT    ',
                      'SM', 'SMON LOCK   ',  'SN', 'SEQNO INSTCE',
                      'SQ', 'SEQNO ENQ   ',  'ST', 'SPACE TRANSC',
                      'SV', 'SEQNO VALUE ',  'TA', 'GENERIC ENQ ',
                      'TD', 'DLL ENQ     ',  'TE', 'EXTEND SEG  ',
                      'TS', 'TEMP SEGMENT',  'TT', 'TEMP TABLE  ',
                      'UN', 'USER NAME   ',  'WL', 'WRITE REDO  ',
                      'TYPE='||l.type) type,
       decode(l.lmode, 0, 'NONE', 1, 'NULL', 2, 'RS', 3, 'RX',
                       4, 'S',    5, 'RSX',  6, 'X',
                       to_char(l.lmode) ) lmode,
       decode(l.request, 0, 'NONE', 1, 'NULL', 2, 'RS', 3, 'RX',
                         4, 'S', 5, 'RSX', 6, 'X',
                         to_char(l.request) ) lrequest,
       decode(l.type, 'MR', o.name,
                      'TD', o.name,
                      'TM', o.name,
                      'RW', 'FILE#='||substr(l.id1,1,3)||
                            ' BLOCK#='||substr(l.id1,4,5)||' ROW='||l.id2,
                      'TX', 'RS+SLOT#'||l.id1||' WRP#'||l.id2,
                      'WL', 'REDO LOG FILE#='||l.id1,
                      'RT', 'THREAD='||l.id1,
                      'TS', decode(l.id2, 0, 'ENQUEUE', 'NEW BLOCK ALLOCATION'),
                      'ID1='||l.id1||' ID2='||l.id2) objname
       from  sys.v_$lock l, sys.obj$ o
       where sid   = s.sid
         and l.id1 = o.obj#(+) ) loop
    dbms_output.put_line(chr(9)||c1.type||' H: '||c1.lmode||' R: '||c1.lrequest||' - '||c1.objname);
  end loop;
  dbms_output.put_line('=====================================================================');
END;
undef 1
set feedback on;
set veri on;

Similar Messages

  • How to check user/session generating a lot of archivelogs?

    Hi,
    On a 10g database, How do i look for the user/session that is generating a lot of archivelogs?
    thanks in advance,

    For currently connected sessions, you could query V$SESSTAT (joining to V$STATNAME). Thus,
    select s.sid, s.value
    from v$sesstat s, v$statname n
    where s.statistic#=n.statistic#
    and n.name = 'redo size'
    order by 2
    /However, there are a few complications :
    1. Persistent Sessions will show up with very high statistics, simply because they haven't disconnected. Many applications maintain Persistent Sessions for either of
    a. Monitoring and Running User Submitted or ScheduleD Jobs (eg in Oracle EBusiness Suite or Peoplesoft)
    b. Connection Pooling
    2. Sessions that have already disconnected will not appear in your report.
    Therefore, you'd have to "sample" sessions frequently and find the incremental redo size. Then, another complication hits you :
    c. Oracle reuses Session IDs. Once a session disconnects, another connecting session may get the same SID. It wouldn't get the same SERIAL# immediately so you might want to use a combination of SID+SERIAL# from V$SESSION as your key (you'd have to add V$SESSION into your monitoring query) Even then, I wouldn't guarantee that the pair wouldn't repeat after some time, particularly with instance restarts.
    You'd be better of using AUDSID from V$SESSION as that value is incremented (and not reused) by session auditing.

  • How to Handle user Session in JSP

    Help me,
    How to handle user session in JSP.......

    Prakash_Pune wrote:
    tell me some Debugging tech. so i can overcome from my problem.....Do you use an IDE? Any IDE ships with a decent debugger where in you can just execute the code step by step, explore the current variable values and check what exactly is happening. For example Eclipse or IntelliJ. If you don´t use an IDE, then just place some System.out.println() or Logger.debug() statements at strategic locations printing the variables of relevance so that you can track in logs what exactly is happening.
    or tell any other way to find is my page is thread safe or not...Just write correct code and narrow the scope of the variables as much as possible. If you for example assigned the user object to a static variable or as a servlet´s instance variable, then exactly the same user object would be used everywhere in the application. That kind of logical things.

  • How to check user profile service working in sharepoint 2013?

    HI All,
    How to check user profile service working or not in sharepoint 2013? Thanks.

    Hi,
    Select which OU's you want to synchronize, then check if all users in those OU's have a user profile in the user profile service application.
    Nico Martens - MCTS, MCITP
    SharePoint 2010 Infrastructure Consultant / Trainer

  • How to check MWA session details in Oracle Apps R12

    I am an Oracle Apps DBA. Current Issue is that sometimes users working with the RF Guns(Scanners) through telnet in MWA servers got hanged.
    They ask to kill their sessions.
    I do not know how to find the MWA loged in users sessions details. What I am able to find is , frm or web session details.
    Could you please guide how to gather these MWA connection details, with database and server process and session details.
    Thanks in advance for ur support.
    Regards,
    KMISRA

    Koushikinath wrote:
    I am an Oracle Apps DBA. Current Issue is that sometimes users working with the RF Guns(Scanners) through telnet in MWA servers got hanged.
    They ask to kill their sessions.
    I do not know how to find the MWA loged in users sessions details. What I am able to find is , frm or web session details.
    Could you please guide how to gather these MWA connection details, with database and server process and session details.
    Thanks in advance for ur support.
    Regards,
    KMISRAPlease see these docs.
    MWA Server Hangs on R12 Environments [ID 559614.1]
    Which parameters control the maximum number of user connections per MWA listener [ID 567214.1]
    Mobile Web Applications (MWA) Troubleshooting Tips for Release 12 Mobile Web Applications Server [ID 782162.1]
    Mobile Application Server - Advanced Configurations and Topologies for Mobile Web Applications (MWA)of E-Business Suite 11i and R12 [ID 1081404.1]
    Mobile Web Applications Server - MWA Troubleshooting Tips for E-Business Suite 11i and R12 Oracle Mobile Application Server [ID 269991.1]
    How to Enable WMS / MSCA Logging? [ID 338291.1]
    Thanks,
    Hussein

  • CISCO ACS, How to Limit User Session ?

    Hi Guys,
    hope you would help me,
    how to limit the user session in ACS 5.x ?
    i'm aware the menu on
    Access Policies >Max User Session Policy > Max Session Group Settings
    i already set the global value to 1, Max Session for User in Group to 1, and Max Session for Group to 1.
    so it means the user only could open 1 connect at the same time right?
    the problem, it didn't works.
    i had 1 ACS 5.5
    2 CISCO Cisco IOS Software, 3700 Software (C3725-ADVENTERPRISEK9-M), Version 12.4(15)T13, RELEASE SOFTWARE (fc3)
    (let's call it R1 and R2 )
    i'm trying to telnet both of them at the same time, and it works ( it means the session limit didn't works, cmiiw )
    i already include :
    radius-server attribute 44 include-in-access-req
    radius-server host 192.168.217.98 auth-port 1645 acct-port 1646 key somekey
    on the line vty :
     accounting connection acs
     login authentication acs
    am i missing something?
    also, is this feature works on tacacs+ too?
    Thanks,

    Dash,
    You can leverage the group mapping feature where members of a certain AD group are mapped to a local group in ACS with the max sessions defined.
    http://www.cisco.com/c/en/us/td/docs/net_mgmt/cisco_secure_access_control_system/5-3/user/guide/acsuserguide/access_policies.html#pgfId-1162308
    Thanks,
    Tarik Admani

  • How to check users inputs

    hi,there
    i am developing an on-line shop,at the end of checking out process , the users are supposed to submit a details form which including first name ,surname, address,email, phone no, card number etc. Can any one tell me how to check those details are valid before sending to database by using javabean or taglib.
    any information is helpful , thanks in advance.

    You have three choices:
    (1) Client-side checking using JavaScript,
    (2) Server-side checking using JavaBeans,
    (3) Both.
    You can check on the client side using JavaScript to make sure that e-mail address formats are valid, numbers are numbers, strings are the right length and format, dates are correct for the locale, etc. You might want to look at the JSTL I18N capabilities here to make sure your pages can handle different locales. This saves you a network roundtrip if something is formatted incorrectly.
    The server-side checking is different: it makes sure that the input satisfies business rules. You can check for correct format again if you wish, OR assume that the client has already taken care of this. (Depends on how paranoid you want to be.) The business rules for correctness belong on the server side, not in the client.
    I'd recommend both. They really are two different kinds of checks.
    MOD

  • How to know user session time

    Hi,
    I want to know how to know or calculate the user session time till now from the time when user got connected
    in simple current_time-begin_time.
    thanks in advance

    Try using the logon_time of v$session
    test@>desc v$session;
    Name                                                  Null?    Type
      LOGON_TIME DATE All columns of the view have not been displayed.
    Adith

  • How to retrieve User Session in Xcelsius 2008

    Hi
    I am currently building dashboards with some securities on display. The dashboards have to show different views (e.g. Manager view with full access of data and Employee view with partial access of data) for different users, and I expect to get the user information (particularly user name) from the BO user session for making the security decision.
    I can successfully retrieve the user session from Dashboard [url button] to JSP using openDocument (by looking at the cookies), but it seems that I have no way to import the data back to the Dashboard. When I am using Data Manager > XML Data (With XML datasource is a JSP file), it seems the user session cannot be retrieved.
    So, my question is, how to retrieve the user Name in Xcelsius 2008 ?
    Any help is greatly appreciated.

    Hi,
    we did also some research activities about Xcelsius. We are passing the user name to the Xcelsius via Webservice. Based on the portal integration, you do not have to care about the authentication to the Webservice. This does the Enterprise Portal for you. For the integration, we are currently using a BSP solution. In this way, you can get the user name very simple:
    sy-uname
    You can put into the Webservice or provide it as Flash Variable to the Xcelsius in the <OBJECT> tag.
    Take care,
    Thomas

  • How to get user session details ?

    Hello.
    I can get user session details querying the "USER_AUDIT_SESSION" view against my developing database.
    I have written a PL/SQL function to retrieve those session details. When I executed the function on the production database I have not got any records. It seems that the underlined view is not being refreshed in the production environment.
    Is there any other view or table, available to unprivileged users, I can use to get session details such as the connection timestamp and the user action ?

    Thanks for the reply.
    Ok, I might check it using a non DBA user, I am not sure, though.
    All the database queries have to be executed under a normal user connection.
    I would like a way to get session details not using "user_audit_session".
    Is there any table or view, available to a default profile user, which has session details and has records as a default behaviour?
    As far as I could check disable audit_trail seems to be the normal behaviour of the clients of my application. There is no records in "user_audit_session".

  • How to check locked session?

    Hi all,
    How do I check locked session,or which tables has been locked.and how to kill the lock session. i would need to do it in sqlplus. we'r not allowed to use toad.

    SELECT sess.osuser AS OsUser, NVL (sess.program, sess.module) AS
    Program, sess.terminal AS Terminal,
    obj.Object_Name AS TABLE_NAME,
    DBMS_ROWID.rowid_create (1, ROW_WAIT_OBJ#, ROW_WAIT_FILE#,
    ROW_WAIT_BLOCK#, ROW_WAIT_ROW#) AS ROW_ID
    FROM dba_objects obj, v$session sess
    WHERE sess.SID IN (SELECT a.SID
    FROM v$lock a, v$session b
    WHERE (id1, id2) IN (SELECT b.id1, b.id2
    FROM v$lock b
    WHERE b.id1 = a.id1 AND
    b.id2 = a.id2 AND b.request > 0)
    AND a.SID = b.SID
    AND a.lmode = 0)
    AND obj.object_id = sess.ROW_WAIT_OBJ#)

  • How to manage User Session in Adf ?

    Is there any guide line to manage the user session in adf ?

    View layer Http session if it is not a desktop based application. Model layer also you can store session using
    getSession().getUserData()But before that the information you provided is not enough. You need to describe in more detail of what session and what exactly are you looking for

  • How to check Locking sessions in oracle 10g

    Hi,
    I have tried to get locking sessions. i got the blocking session by using v$lock view.
    Pls help how to get locking sessions.
    Regards,
    Venkat

    Hi Venkat
    Or just run this independent of database version
    select a.sid blocker, 'is blocking the session ', b.sid blockee from v$lock a, v$lock b
    where a.block =1 and b.request > 0  and a.id1=b.id1 and a.id2=b.id2;You can extend this query to find the username and machine (plus all other details) from v$session using the a.sid and b.sid from above
    To find the blocking session_
    SELECT S.SID, S.SQL_ID, S.USERNAME, S.MACHINE from
    V$SESSION S WHERE S.SID  = (SELECT blocker from
    (select a.sid blocker, 'is blocking the session ', b.sid blockee from v$lock a, v$lock b
    where a.block =1 and b.request > 0  and a.id1=b.id1 and a.id2=b.id2
    *_To find the blocked session_*SELECT S.SID, S.SQL_ID, S.USERNAME, S.MACHINE from
    V$SESSION S WHERE S.SID = (SELECT blockee from
    (select a.sid blocker, 'is blocking the session ', b.sid blockee from v$lock a, v$lock b
    where a.block =1 and b.request > 0 and a.id1=b.id1 and a.id2=b.id2
    Edited : Added blocker and blockee code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to end user session correctly as sys or system user

    Hi,
    Database version Oracle 10.2.0.3
    We have to end user sessions to update database content. We cant stop/shutdown the instance but we have to assure that some users are not logged on.
    So we are looking for a solution to end some arbitrary user sessions as sys or system user without using the KILL USER SESSION option. We want to assure that the user sessions end correctly.
    Is there a possibility or a command in Oracle 10g to end a user session correctly ?
    Thanks for your assistance.

    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_2013.htm#i2053602
    I think DISCONNECT SESSION Clause is what you are looking for.
    Let us know if this is not the case.

  • Batch/Maxl File to check user session in Essbase and delay batch by 15 m

    Hi,
    I want to write a maxl file which will check session for any user in Essbase.
    If any session is active batch File will be delayed by 15 minutes.
    Please let me know how i will achive this. (Syntax will be helpful).
    Thanks,
    Ajay Singh

    Hi,
    Thanks for your reply,I want to know the active users for particular Application.
    If any user is active and if I am able to find it using maxl then I have batch file which suppose say runs at 10.00 AM
    then that batch file i will delay by 15 min using cmd.
    Can you give me maxl and cmd for it.
    Thank,
    Ajay Singh

Maybe you are looking for

  • Assets management and inventory Management.

    This may be simple situation often encountered in industries. The need is to manage an item as an asset as well as manage inventory functions of purchasing, receiving, physical inventory and issue of these assets to customers as inventory materials.

  • SOAP Header XSLT mapping

    Hi, I am working on Proxy to SOAP synchronous scenario.  How to create SOAP header message in XSLT mapping...I am trying but no sauces becz receiver side SOAP header and Body in different message types please see below. Header part is message type 1

  • Where can I sell my MacBook Pro?

    Hello! I want to sell my MacBook Pro so I can get a Retina MacBook Pro Where can I sell it? I don't want some crappy service like gazelle that gives you less than its worth and cannot sell on eBay as I don't have a credit card. I don't want to use cr

  • Cannot open file in Illustrator or Photoshop

    please help I have unistalled and downloaded again Photoshop, Illustrator and Xpro from Creative Cloud When i try to open up a file the window dissapears or says program error Very frustrating please help

  • Two Questions: Not online and no media?

    Okay, these two go hand in hand, so one post. I'm on Adobe Media Player, latest version, and I just updated it and it went to the home screen without any media on it. I tried looking through this site to find some help, but nothing. Any idea why it w