Tracing a session among sessions

Hi all,
It is always easy to track the session if we know that this session is causing problem.But how to track/trace a problem causing session when we don't know that which session is the cause of concern?
Or in other words how to track the sid for the problem causing session?

I'm sure you would have the information what is the problem is and roughly who are the user that is having the problem. From there roughly you would know the code and the module responsible for the problem.
If it is a locking issue, then you can check the v$lock as a start or check dba_waiters (catblock.sql) to find the session id.
For a performance issue, you may start checking session with long operation using v$session_longops
However, a great feature is to properly instrumenting your application by using the
dbms_session.set_identifier
dbms_application_info.set_module
And using the dbms_monitor to turn tracing on based on client identifier, service, module, action.
Rgds
Ung
Edited by: Kok Aik on Dec 2, 2008 11:16 AM

Similar Messages

  • Traceing another session does not written to the UDUMP

    Hello,
    Version 10203.
    SQL> oradebug setorapid 502
    Unix process pid: 16426, image: oracle@cupidon
    SQL> oradebug setospid 16426
    Oracle pid: 502, Unix process pid: 16426, image: oracle@cupidon
    SQL> oradebug event 10046 trace name context forever, level 12 
    Statement processed.
    SQL> But when looking for the file in the udump it does not exists :
    ls -l perp_ora_16426.trc
    perp_ora_16426.trc not found
    Can one suggest for a reason why its happened ?
    Thanks

    Hi, use the following for tracing a particular session of a schema
    1)sqlplus system/system@orcl
    2)check the sid and serial# of the session from v$session
    Use the following query to find out which sesssion you want to trace
    SQL> select username,to_char(logon_time,'DD-MON-YYYY HH:MI:SS') from v$session where username='<db username>' order by logon_time;
    SQL>exec sys.dbms_system.set_sql_trace_in_session(sid,serial#,TRUE);
    3)now execute the report/transaction.
    4)once the activity is over
    SQL>exec sys.dbms_system.set_sql_trace_in_session(sid,serial,FALSE);
    5)Now the trace file will be available in the udump folder of the database
    The trace wil be available in $oracle_home/admin/orcl/udump
    6)To find the name of the trace file use the below query
    select spid from v$process where addr=(select paddr from v$session where sid=<enter the SID>);
    This will give the name of the file
    If you are not able to identify the trace file then please remove all files in udump before starting trace.
    7) copy the trace file to ur local pc and issue the tkprof command
    TKPROF <trace file (like D:\orcl_8853.trc)> D:\trace.txt explain=Oracle username/password (application user) sort=(prsela,exeela,fchela)
    This will give trace file in readable format(you need to have oracle client on your pc for tkprof to work)

  • Tracing individual session from connection pool

    Dear all,
    DB : 10.2.0.4.0 (RAC)
    Solaris 5.10
    Application : Oracle SOA 10.1.3
    We have CRM application deployed in SOA which inturns connects to RAC DB for data.All the
    connections from SOA comes through a connection pool to the DB. Now, is there any way I can able to trace a individual session coming form this connection pool ?
    Please guide ?
    Kai

    You have a couple of options as far as I know:
    1. If you are using a Client Identifier that is granular enough to identify a particular user you can enable tracing at that level.
    2. You could try and capture the particular SID and SERIAL# for the session and enable tracing that way.
    The [DBMS_MONITOR|http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_monitor.htm#i1003679] package provides the interface to enable tracing.
    HTH!

  • Enable SQL Tracing for Session

    Hi,
    I know how to enable SQL tracing for a session created either through SQL*Plus or like similar tool, but I want to explore is there any way to can we enable sql tracing for a single session which is connected to database through an application.
    ssome time for testing purpose we have a requirement to enable tracing for that user which run batch Job. Now that particular user gets connected to database through application and i want to enable tracing right at that moment. How can I accomplish it.
    Regards,
    Ababsi

    If you don't want to identify database session you can try to create a logon trigger to enable tracing for all database sessions created by a specific Oracle user account. In the following example you need to replace UWCLASS with the Oracle user account for which you want to trace sessions:
    CREATE OR REPLACE TRIGGER trace_trig
    AFTER LOGON
    ON DATABASE
    DECLARE
    sqlstr VARCHAR2(200) := 'ALTER SESSION SET EVENTS ''10046 TRACE NAME CONTEXT FOREVER, LEVEL 12''';
    BEGIN
      IF (USER = 'UWCLASS') THEN
        execute immediate sqlstr;
      END IF;
    END trace_trig;
    /Reference:
    http://psoug.org/reference/system_trigger.html
    If you want to identify database session you need to query V$SESSION to retrieve SID and SERIAL# of the session you want to trace and then you can use DBMS_MONITOR. See examples in http://www.oracle-base.com/articles/10g/SQLTrace10046TrcsessAndTkprof10g.php
    Edited by: P. Forstmann on 15 janv. 2011 11:07

  • SQL Tracing for session started from Java code

    I am working with Oracle 10g on Solaris 9. I am facing a problem when trying to enable SQL Trace for Oracle sessions initiated from Weblogic server. I am querring V$SESSION to get the SID and SERIAL# of those sessions and then using DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION(<sid>, <serial#>, TRUE); from the SQLPlus (using sys login). But the trace file is not being generated in UDUMP even after some queries are fired from the application. But when I am using the same procedure to turn SQL Trace on for SQLPlus sessions or SQLDeveloper sessions, they are just working fine.
    Can anyone please help me out?

    Please help.....
    There is already a thread
    Problem with SQL_Trace for a Session
    but there is no solution there.

  • Session Tracing problem?

    when i am trying to trace a session using
    dbms_system.set_sql_trace_in_session(sid,serial#,true);
    command is executing succesfully but the trace file is not getting generated in udump location.
    even if i try
    dbms_execute.set_ev(sid,serial#,Ev=>10046,Le=>0,NM='')
    its executing but trace file is not generated in udump location.
    expert help is highly appreciated.
    Thank you....

    If you start then stop tracing a session then delete the file from the OS the trace file does not get regenerated.
    what OS are you using as there are some ways round this on unix, not sure about windows.
    on unix you canuse the following.
    find the process id of the session being traced using
    select s.sid,s.serial#,s.username,p.SPID
    from v$session s,v$process p
    where s.PADDR=p.ADDR and sid = &sid;
    using the SPID run the following as sysdba
    oradebug setospid SPID
    oradebug close_trace
    oradebug flush
    now restart the trace.
    Message was edited by:
    chris_c

  • Signon tracing enable multi-session trace file?

    Hi Guys,
    When I enable PeopleCode tracing in signon tracing link, I found trace file was generated with somebody else name. I was thinking it should generate my trace file only. Does anyone know if it is correct or these is any configuration about this?
    Thanks,
    Bob

    John_75 wrote:
    Thank you DBMS_DIRECT.
    trace is enabled only on the instance to which the caller is connected
    So, how do i enable tracing for sessions spawned by Java or C++ applications.
    According to the documentation, i can use DBMS_MONITOR for tracing applications
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/sqltrace.htm
    Your 2 node RAC has two instances (e.g. INST1 and INST2). My understanding of that is that with the above command, to be able to trace session 123 connected to INST1, your SYS need to be connected to INST1. To be able to trace session 456 connected to INST2, your SYS need to be connected to INST2.

  • Session trace files not generated

    Hai all,
    Am tracing a session as follows :
    EXEC DBMS_SUPPORT.start_trace_in_session(sid=>2166, serial=>30629, waits=>TRUE, binds=>FALSE);
    EXEC DBMS_SUPPORT.stop_trace_in_session(sid=>2166, serial=>30629);
    but,no trace files are getting generated ?.. in udump dir..
    Any idea ?
    Kai

    Likely a version and/or platform specific bug.
    However, according to you this information is not important, or too much cumbersome to type, so no one can help you, even if you were told to include this several time.
    If you want free support from volunteers, at least provide information to work in.
    Or consider not posting at all.
    Sybrand Bakker
    Senior Oracle DBA

  • Trace file created for the wrong session

    DB version : 10.2.0.3.0
    OS version: Solaris 5.10
    2 node RAC
    Using DBMS_MONITOR.SESSION_TRACE_ENABLE, I have been trying to trace an oracle session spawned by a C++ application.
    So, i determined which instance this session is connected by querying gv$session. I logged in as SYS in that instance's Node and then issued
    execute dbms_monitor.session_trace_enable(4371,98124, true, false);After enabling, i saw new A trace file being generated. But this trace is actually tracing SYS's session which executed dbms_monitor.session_trace_enable and not the session (4371,98124) !!! I tested few basic queries in SYS's session like
    select sysdate from dualAnd i can see all these queries appearing in the trace file. What could be the cause of this issue?
    I have noticed that
    SHARED_SERVERS = 1 on both nodes. Is this causing this weird issue? For tracing, If i disable SHARED_SERVERS using
    alter system set SHARED_SERVERS = 0
    will it cause any connection problems for the client applications because of their tnsnames.ora file setting?

    John_75 wrote:
    Thank you DBMS_DIRECT.
    trace is enabled only on the instance to which the caller is connected
    So, how do i enable tracing for sessions spawned by Java or C++ applications.
    According to the documentation, i can use DBMS_MONITOR for tracing applications
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/sqltrace.htm
    Your 2 node RAC has two instances (e.g. INST1 and INST2). My understanding of that is that with the above command, to be able to trace session 123 connected to INST1, your SYS need to be connected to INST1. To be able to trace session 456 connected to INST2, your SYS need to be connected to INST2.

  • Trace session

    I have executed a SQL statement on two servers with exactly the same configuration,OS and DB version.I traced the sessions on both the servers executing the same SQL.Now i need to find out from those trace files which SQL is performing better then the other.what are the factors i need to cosider to come to a conclussion that this SQL's performance is better than the other SQL.The result of processed trace files using tkprof is as below.
    //SQL in server A
    SELECT SERVICE.TERM
    FROM
    abc.TARIF_SERVICES TS,abc.DIC_DATA SERVICE WHERE TS.N =:B2 AND TS.SERVICE=
    SERVICE.CODE AND SERVICE.UP=9 AND SYSDATE BETWEEN SERVICE.FD AND SERVICE.TD
    AND SERVICE.LANG=1 AND :B1 BETWEEN TS.FD AND TS.TD
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 5203 0.57 0.53 0 0 0 0
    Fetch 5203 0.15 0.59 48 26071 0 5203
    total 10407 0.73 1.13 48 26071 0 5203
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: 55 (recursive depth: 1)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 48 0.01 0.33
    //SQL in server B
    SELECT SERVICE.TERM
    FROM
    abc.TARIF_SERVICES TS,abc.DIC_DATA SERVICE WHERE TS.N =:B2 AND TS.SERVICE=
    SERVICE.CODE AND SERVICE.UP=9 AND SYSDATE BETWEEN SERVICE.FD AND SERVICE.TD
    AND SERVICE.LANG=1 AND :B1 BETWEEN TS.FD AND TS.TD
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 5203 0.57 0.53 0 0 0 0
    Fetch 5203 0.15 0.59 48 26071 0 5203
    total 10407 0.73 1.13 48 26071 0 5203
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: 55 (recursive depth: 1)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 48 0.01 0.33
    Thank you all...

    Formatting the output
    SELECT SERVICE.TERM
    FROM
    abc.TARIF_SERVICES TS,abc.DIC_DATA SERVICE WHERE TS.N =:B2 AND TS.SERVICE=
    SERVICE.CODE AND SERVICE.UP=9 AND SYSDATE BETWEEN SERVICE.FD AND SERVICE.TD
    AND SERVICE.LANG=1 AND :B1 BETWEEN TS.FD AND TS.TD
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 5203 0.57 0.53 0 0 0 0
    Fetch 5203 0.15 0.59 48 26071 0 5203
    total 10407 0.73 1.13 48 26071 0 5203
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: 55 (recursive depth: 1)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 48 0.01 0.33
    //SQL in server B
    SELECT SERVICE.TERM
    FROM
    abc.TARIF_SERVICES TS,abc.DIC_DATA SERVICE WHERE TS.N =:B2 AND TS.SERVICE=
    SERVICE.CODE AND SERVICE.UP=9 AND SYSDATE BETWEEN SERVICE.FD AND SERVICE.TD
    AND SERVICE.LANG=1 AND :B1 BETWEEN TS.FD AND TS.TD
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 5203 0.57 0.53 0 0 0 0
    Fetch 5203 0.15 0.59 48 26071 0 5203
    total 10407 0.73 1.13 48 26071 0 5203
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: 55 (recursive depth: 1)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 48 0.01 0.33As Sybrand already mentioned,the results are identical.Is it somethig that is reported for either query that it is slow compared to the other one?If you suspect some performance degradation than you may want to trace both the queries with 10046 trace.Search this forum for this event and use it to trace the queries further.
    Aman....

  • Doesn't close properly the anonymous user's session.

    Hello experts.
    We are implementing the anonymous user in Portal, according to the following link:
    http://help.sap.com/saphelp_nw04s/helpdata/en/1e/e19f58136e654d9709befa464314f2/frameset.htm
    We have used the notes: 709354, 837898 and 728106
    And the only problem we found and we couldn't solve is when the anonymous user navigate between links, Portal is trying to close the session anonymous without success, showing each click an Error like this:
    " Run-time Error Portal
    Exception processing application, send your exception ID Portal Administration
    11:07 20/01/100517_4300950 exception ID
    More details on this exception in the corresponding protocol file "
    We haven't found useful information in the default trace.
    For this we implemented the note "755947 - Session Release Agent - Guest Access" note but still unresolved.
    Any advice would be helpful.
    Best regards.
    Ernesto

    Hi Ernesto.
    You need to activate logging and tracing on Session Release Agent (refer to SAP Note 596698), then post an information relevant for Session Release Agent here.
    Best regards,
    Aliaksandr Zhukau
    P.S.: Do you use a FQDN?

  • Tracing

    Hi,
    Oracle Database : 11.2.0.1
    I am executing a procedure and want to enable tracing for it. Should i go for system wide tracing or session level tracing.
    ALTER SESSION SET EVENTS '10046 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    Is the above command OK to enable tracing in oracle?
    Thanks

    864751 wrote:
    Hi,
    Oracle Database : 11.2.0.1
    I am executing a procedure and want to enable tracing for it. Should i go for system wide tracing or session level tracing.But why you want to enable for the whole system?
    ALTER SESSION SET EVENTS '10046 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    Is the above command OK to enable tracing in oracle?
    Yep.
    Aman....

  • Tracing Problem

    Hi,
    I was tracing a session using the oradebug utility.
    oradebug setorapid ' '
    statement was processed
    oradebug event 10046 trace name context forever,level 12
    Statament processed
    When i tried to find out the name of the trace file using :
    oradebug tracefile_name
    statement processed(But it didn't show the tracefile name)
    Trace file for the session was not generated but it is still filling the file system. What can i do to stop this ??
    I cannot restart the database as it is a 24*7 production system.
    Please help me out...
    Regards
    Kirti

    Kirti,
    What you are saying does not make sense. If the trace file for the session was not generated, how can it be filling up the file system?
    If you are wanting to turn off tracing, use event 10046 with a level of 0 or context off.
    Regards,
    Daniel Fink

  • Tracing activities in the database

    I want to trace an failed installation. The problem is every time I run it, it will spawn a new session. So I cannot set up trace on the session in advance. Is there a way to set up trace on all the sessions (including the new one) or trace all the activities against the database?

    How can I use trcsess to combine all the trace files. I don't need to pass all the parameters, right? The following does not work.
    EKGU:/data/EKGU/dump/udump:>ls
    ekgu_ora_7929.trc ekgu_ora_7935.trc ekgu_ora_7941.trc ekgu_ora_7949.trc ekgu_ora_7955.trc
    ekgu_ora_7931.trc ekgu_ora_7937.trc ekgu_ora_7945.trc ekgu_ora_7951.trc ekgu_ora_7957.trc
    ekgu_ora_7933.trc ekgu_ora_7939.trc ekgu_ora_7947.trc ekgu_ora_7953.trc ekgu_ora_7959.trc
    EKGU:/data/EKGU/dump/udump:>trcsess ekgu *
    oracle.ss.tools.trcsess.SessTrcException: SessTrc-00002: Session Trace Usage error: Wrong parameters passed.
    trcsess [output=<output file name >] [session=<session ID>] [clientid=<clientid>] [service=<service name>] [action=<action name>] [module=<module name>] <trace file names>
    output=<output file name> output destination default being standard output.
    session=<session Id> session to be traced.
    Session id is a combination of session Index & session serial number e.g. 8.13.
    clientid=<clientid> clientid to be traced.
    service=<service name> service to be traced.
    action=<action name> action to be traced.
    module=<module name> module to be traced.
    <trace_file_names> Space separated list of trace files with wild card '*' supported.

  • Copying large amount of data from one table to another getting slower

    I have a process that copies data from one table (big_tbl) into a very big archive table (vb_archive_tbl - 30 mil recs - partitioned table). If there are less than 1 million records in the big_tbl the copy to the vb_archive_table is fast (-10 min), but more importantly - it's consistant. However, if the number of records is greater than 1 million records in the big_tbl copying the data into the vb_archive_tbl is very slow (+30 min - 4 hours), and very inconsistant. Every few days the time it takes to copy the same amount of data grows signicantly.
    Here's an example of the code I'm using, which uses BULK COLLECT and FORALL INSERST to copy the data.
    I occasionally change 'LIMIT 5000' to see performance differences.
    DECLARE
    TYPE t_rec_type IS RECORD (fact_id NUMBER(12,0),
    store_id VARCHAR2(10),
    product_id VARCHAR2(20));
    TYPE CFF_TYPE IS TABLE OF t_rec_type
    INDEX BY BINARY_INTEGER;
    T_CFF CFF_TYPE;
    CURSOR c_cff IS SELECT *
    FROM big_tbl;
    BEGIN
    OPEN c_cff;
    LOOP
    FETCH c_cff BULK COLLECT INTO T_CFF LIMIT 5000;
    FORALL i IN T_CFF.first..T_CFF.last
    INSERT INTO vb_archive_tbl
    VALUES T_CFF(i);
    COMMIT;
    EXIT WHEN c_cff%NOTFOUND;
    END LOOP;
    CLOSE c_cff;
    END;
    Thanks you very much for any advice
    Edited by: reid on Sep 11, 2008 5:23 PM

    Assuming that there is nothing else in the code that forces you to use PL/SQL for processing, I'll second Tubby's comment that this would be better done in SQL. Depending on the logic and partitioning approach for the archive table, you may be better off doing a direct-path load into a staging table and then doing a partition exchange to load the staging table into the partitioned table. Ideally, you could just move big_tbl into the vb_archive_tbl with a single partition exchange operation.
    That said, if there is a need for PL/SQL, have you traced the session to see what is causing the slowness? Is the query plan different? If the number of rows in the table is really a trigger, I would tend to suspect that the number of rows is causing the optimizer to choose a different plan (with your sample code, the plan is obvious, but perhaps you omitted some where clauses to simplify things down) which may be rather poor.
    Justin

Maybe you are looking for

  • Dual 30" ACDs not working correctly in mirror mode

    My Apple Care guy is telling me that the problem I have is known and there is nothing they can do for me. I find this hard to believe, especially since it seems like I'm the only one complaining about this, so, before throwing in the towel and accept

  • Need a little help with placing divs?

    I am wanting to know How I can place three divs exactly like the picture shown. I am sure this is pretty easy for most of you so I am going to just leave this picture! Thanks for your help in advance!

  • I have a VI that belongs to a library that is not properly licensed on the laptop Im using. How do I get it licensed?

    I have an error stating a VI belongs to a library that is not properly licensed on the laptop I'm using.  Can anyone tell me how do I get it licensed?  (version LabVIEW 8.5.1) Nick Salemi Teledyne Energy Systems, Inc. [email protected] 410-891-2225

  • App store login not working

    WHen I go to the App store or to apps that I have already loaded onto my iMac, it will ask for my password, which i provide. THe response is either "unknown error has occured" or invalid user/pw. So after a few tries i will go to the "forgot password

  • Loss of audio in IDVD preview

    So i created a travel movie in iMovie with soundtrack from iTunes and narration through microphone. I "shared" the project with iDVD but when I preview the movie, all the sound is gone. It worked fine when I did a snowboarding movie last weekend. Sho