Finding the long running queries

Hello, I am able to find the long running queries in my database as below.
SQL> select sid,serial#
2 from v$session_longops
3 where time_remaining > 0
4 order by time_remaining desc;
SID SERIAL#
1100 4411
1383 3912
1295 2493
SQL>
With this info, i want to find out what sql code related to these (SID,SERIAL#). The SQL code comes from v$sqlarea. But i am not able to join v$session_longops with v$sqlarea. Any help is highly appreciated.
Here is my database version.
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production

Thank you!!!
select     
A.SID ,
A.SERIAL# ,
A.OPNAME ,
A.TARGET ,
A.TARGET_DESC,
A.SOFAR ,
A.TOTALWORK ,
A.UNITS ,
A.START_TIME ,
A.LAST_UPDATE_TIME ,
A.ELAPSED_SECONDS ,
A.CONTEXT ,
A.MESSAGE ,
A.USERNAME ,
B.sql_fulltext
from     v$session_longops a,
v$sqlarea b
where a.sql_id = b.sql_id
and     time_remaining > 0
order by time_remaining desc

Similar Messages

  • Query to find the long running concurrent requests morethan 2 hours

    Can any one please provide the " Query to find the long running concurrent requests which are running more than 2 hours"

    You need to find the different between the current time/date and FND_CONCURRENT_REQUESTS.ACTUAL_START_DATE for the running requests.
    More details can be found in the following notes:
    Note: 187504.1 - bde_request.sql - Process and Session info for one Concurrent Request (11.5)
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=187504.1
    Note: 134035.1 - ANALYZEREQ.SQL - Detailed Analysis of One Concurrent Request (Release 11 and up)
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=134035.1
    Note: 751438.1 - How To Check List , Start And End Dates Of A Parent Concurrent Request And All Childs
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=751438.1

  • How can find out long run quries?

    Hi,
    I have some question
    how can find out long run queries , i have use v$session but i have not find out,pls how can find out
    these queries.

    v$session_longops has some limitations, for example it records only some operations see more [url http://www.gplivna.eu/papers/v$session_longops.htm]here
    Another possibility might be using statspack and/or [url http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14211/autostat.htm#PFGRF02601]AWR
    From docs:
    The most current instructions and information on installing and using the Statspack package are contained in the spdoc.txt file installed with your database. Refer to that file for Statspack information. On Unix systems, the file is located in the ORACLE_HOME/rdbms/admin directory. On Windows systems, the file is located in the ORACLE_HOME\rdbms\admin directory.
    Gints Plivna
    http://www.gplivna.eu

  • Script for gather and store the log running queries details in a table?

    Hi All,
    Please suggest the best query that gather and store the long running queries details in a table.
    Thanks,
    rup

    The below links would help you...
    Ben Snaidero
    performance-dashboard

  • Identify Long Running Queries

    Hi,
    I need to identify the long running queries from a asp.net web application where connection pooling is enabled
    and need to stop them without killing session.
    Please guide me
    Thanks & Regards
    Nimish Garg

    SELECT  SYS_CONTEXT('USERENV','SERVER_HOST')           ENV,
            SYS_CONTEXT('USERENV','DB_NAME')               DATABASE_NAME,
            ROUND(A.ELAPSED_TIME / A.EXECUTIONS / 1000000) SQL_AVERAGE_ELAPSED_TIME,
            A.SQL_ID                                       SQL_ID,
            A.SQL_FULLTEXT                                 SQL_TEXT,
            A.EXECUTIONS                                   SQL_EXECUTIONS,
            NVL(S.PROGRAM,A.MODULE)                        SESSION_PROGRAM_NAME,
            NVL(S.USERNAME,A.PARSING_SCHEMA_NAME)          SESSION_USER_NAME,
            S.OSUSER                                       SESSION_OS_USER_NAME
      FROM  V$SQLAREA A,
            V$SESSION S
      WHERE A.SQL_ID = S.SQL_ID(+)
        AND A.EXECUTIONS > 0
        AND ROUND(A.ELAPSED_TIME / A.EXECUTIONS / 1000000) > threshold-in-seconds
    /SY.

  • Advice  on long running queries

    Hi all
    I am a junior dba and facing problem of log runninig queries. Can anyone help and let me know how to resolve the long running queries. I mean what should be the approach to findout out the problem.
    Please guide me.
    thanx
    Ajay

    >
    OK, so what about your buddy Jonathan Lewis who
    includes THREE hyperlinks in his sig line?
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    Author: Cost Based Oracle: Fundamentals
    http://www.jlcomp.demon.co.uk/cbo_book/ind_book.html
    The Co-operative Oracle Users' FAQ
    http://www.jlcomp.demon.co.uk/faq/ind_faq.html
    Tsk, tsk, the naughty little man is telling lies again.
    There's a search feature on the Oracle forum - it let's you search by user and ask for key words. I've searched against my identify looking for "ind_faq", and then for "cbo_book". It doesn't return any posts with that sig.
    And here's another thought: your comment about me being a buddy of Sybrand (who you were trying to claim did not exist just a few hours ago) reminded me that I have had reasons to criticise him in the recent past - for example Re: to_char and performance - and he managed to take it without descending into a hissy fit.
    And finally - a little logical error on your part. The fact that I know that Sybrand Bakker exists does not mean that he is a buddy of mine or that I am a buddy of his. After all, I know that you exist.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk

  • How to get the list of long running queries

    hi,
         my requirement is to get the list of long running queries in bi and also what are the steps to reduce running time of quires.
    thanks.

    Hi Venkat,
    The statistics information will give you time the query takes while opening it
    For Eg,with BEx Analyzer,you have an option in Global Settings->Display Statistics.
    If you open a query from backend in Analyzer,and then click "Display Statistics",it will show the amount of time it takes to load it.
    Other than this there might be some tcodes available to read this value.
    Rgds,
    Murali

  • Script to find the list of Queries currently running in database with User Login Name and Host Name.

    Hai,
    How to find the list of queries currently running in the Database with User Login Information.
    Since my database application is running slow, to find the slow queries.

    Try the below query
    SELECT r.start_time [Start Time],r.session_id [SPID],
    DB_NAME(database_id) [Database],
    s.host_name,
    s.program_name,
    s.login_name,
    SUBSTRING(t.text,(r.statement_start_offset/2)+1,
    CASE WHEN statement_end_offset=-1 OR statement_end_offset=0
    THEN (DATALENGTH(t.Text)-r.statement_start_offset/2)+1
    ELSE (r.statement_end_offset-r.statement_start_offset)/2+1
    END) [Executing SQL],
    r.status,command,wait_type,wait_time,wait_resource,
    last_wait_type
    FROM sys.dm_exec_requests r
    OUTER APPLY sys.dm_exec_sql_text(sql_handle) t
    inner join sys.dm_exec_sessions s
    on s.session_id = r.session_id
    WHERE r.session_id !=@@SPID -- don't show this query
    AND r.session_id > 50 -- don't show system queries
    ORDER BY r.start_time
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

  • Resolving long running queries

    Hi,
    Can we directly implement the recommendations provided by Oracle EM's SQL Tuning advisor *(10g)* as it's for long running queries or we have to do any extra steps?
    I hope we have to compare the SQL Execution plan for the existing query and the recommended query, is this enough or any more? Please post
    Thanks
    Hari.

    Hi,
    i think
    Can we directly implement the recommendations provided by Oracle EM's SQL Tuning advisor *(10g)* as it's for long running queries or we have to do any extra steps?
    NO you cann't. I.e you can accept the profile recommended by Advanced optimizer but it wont affect/change already long runing query.
    I hope we have to compare the SQL Execution plan for the existing query and the recommended query, is this enough or any more? Please post
    Generally SQL profile contain advance information needed by optimizer to produce efficient explain plan. If you look inside SQL profile, you will find that it ultimately contains some set of SQL HINTS.
    So answer to your first question NO because when SQL first hard parse/soft parse it already have generate/used plan for its query, so you cannt change existing running query. The new accepted SQL profile will be used in Next run.
    Answers to your second question - Once you run the SQL tuning advisor you would generally see other recommends too, for example statistics are stale, create new set of indexes etc etc. So you should first focus on these recommendations first. I know its bit cubersome to implement all these recommendations but practically when you implement these reco (apart from accepting sql profile) and again run SQL Tuning advisor then could see previous recommendations went away(as you already implemented them), but if SQL Tuning advisor again recommends you to accept profile then i think it would be OK. Because you already explored other tunning techniques recommended by optimizer. Also SQL profile too can become stale and for which you should maintain them.

  • Profiler execution plan ONLY for long running queries

    The duration only applies to specific profiler events however I'd like to capture the execution plan ONLY for queries over 10 minutes.
    Is there a way to do this using Xevents?
    Anyone knows?
    Thanks!
    Paula

    I've wanted that too but could not find a way to get it from profiler.
    But it may be possible with xevents (or without xevents!) to watch for long-running queries and then get the plan from the cache,where it will probably stick for some time, using DMVs.
    Josh

  • Long Running Queries / Multicube

    Hi,
    Please can some one help to find this
    1. To identify top 5 long running queries on each multiprovider
    2. Some of the multi providers have lot of cubes within it but they are not used at all.
    To find out in last 6 months which base providers are not used or even if used they bring zero records

    Hi
    This is due to the poor system performance
    Check ur Statistics and no of records per data packet
    and u have to raise ticket if this is a permanent problem
    Check if there's a short dump in ST22. Also make sure that volume of data that you are trying to update is managable.
    Check to where the time is being taken whether is on the source side or BW side.
    Check for any customizations whatsoever on the source side and the BW side.
    Break down the data packet size to smaller chunks.
    Check if there is any routines/code that is causing the long running loads and optimize that.
    Check SM58 to see if there are any stuck data packets.
    hope it helps
    regards
    gaurav
    Edited by: Gaurav  Paul on Sep 24, 2008 4:18 PM

  • How can i cancel long running queries (red x doesnt work)

    hi there
    i am trying to work with some long running queries - it would be very nice to be able to cancel them (like toads cancel button)
    I have tried the red X in the circle but it doesnt seem to work - it appears to have cancelled it (the cylon-eye style comfort bar stops ocillating) but if i try to use the connection again, or disconnect or open another connection it says:
    "connection currently busy. Try again?"
    i have tried this in the latest release vanilla & the latest release plus patch 2
    thanks
    Martin

    Good news that this will be improved. Can't resist to post this Link: [plsql forum thread about start/stop.. | http://forums.oracle.com/forums/thread.jspa?forumID=75&threadID=927697]
    I have experienced the same and also noted that it feels better to execute stored procedures in sqldeveloper
    - by editing
    - compiling (might hang if already busy)
    - run from the same dialog just to get the the cylon's eye for emergency stops (which waits .... ) meanwhile jump to apex to fiddle with small table triggering exception to stop the procedure.
    If stored procedure is executed from the list via 'right mouse click'-style then you see in the log-region "connecting to databse ... ." but no method to stop nor cancel or cylon's eye is well hidden.
    When such "busy" is running I also noted that the database-connection right mouse click has greyed/inactivated the selections "connect/disconnect" so the next logical step for stopping via "disconnect" is out of the question.
    I think this also boils down also to question whether the user has rights to see gv$session and be able to drop/stop busy/jamming sessions. E.g. public synonyms listing has small icons with mystic red :)
    /paavo
    Java(TM) Platform     1.6.0_14
    Oracle IDE     1.5.4.59.40

  • Cancelling of Long Running Queries feature for GRID data block

    Hi,
    Maybe someone knows solution-
    we have custom form with Spreadtable (JTF_GRID object) block (similar as, for example, EBS form WMSCTLBD).
    Is here any possibility to enable ‘Cancel Long Running Queries’ feature for it?
    I have reviewed built-in JTF_GRID library (with hope to implement it by adding some custom timer) but I cannot find any API which could be used for cancelling already submitted queries.
    I have created a SR but analyst suggested to ask for it in forums :)
    Our Oracle Forms Version is 6.0.8.28.0
    Thanks in advance.
    BR,
    Kristaps

    Try CTRL-ALT-DELETE
    :-)

  • Terminating long running queries

    For our web reporting application we're using SQR with Oracle 9 as a back end tool. The front end, using a java servlet, invokes SQR program, which in turn connects to the data base with a common (not user specific) user name and generates an output.
    The problem is that when a query runs for too long, the front end will time out or a user may close the window and start over. But when the client session is aborted, the server session is still running consuming resources, which makes the next query performance even worse.
    Question 1: Is there any way that upon connection to the database I can get a session ID, so I can use it to kill the server session before the client session is aborted.
    Question 2: Is there any other way of managing these long running queries and their orphan server sessions.

    You may:
    select sid, serial#, machine, program, username
    from v$session;

  • How to find the list of Queries/Reports which are using Exceptional Aggregation in SAP BI?

    Hi All,
    We are interested to know how to find the list of Queries/ Reports which are using Exceptional aggregation in SAP BI.
    Please let us know is there any table's to check the list of reports using Exceptional Aggregation in SAP BI.

    Hi,
    Here you go..
    1) Go to table RSZCALC and get list of ELTUID where AGGREXC is not INITIAL and AGGRCHA is not initial; now you get only exception aggregation set based on some chars. Also you can further add STEPNR = 1 since your intention is just to get query name , not the calculation details; this will reduce number of entries to lookup and save DB time for next steps.
    Here you will get list of exception aggregation UUID numbers from which you can get properties from RSZELTDIR.
    2) Pass list of RSZCALC-ELTUID to table RSZELTXREF - TELTUID and get list of RSZELTXREF -SELTUID - this table stores query to it's elements maping kind.
    3) Now again pass RSZELTXREF - SELTUID into same table but into different field RSZELTZREF - TELTUID and get RSZELTXREF - SELTUID
    This step you get query reference sheet or column or query general UUID for next step.
    4) Pass list of RSZELTXREF - SELTUID into RSZELTDIR - ELTUID with DEFTP as 'REP'. Now you get list of query names in RSZELTDIR - MAPNAME and description in TXTLG.
    Note: you can also get the reference chars used for exception aggregation from RSZCALC - AGGRCHA field.
    Hope this helps.
    Please keep in mind, it might take more time depends on how many query elements you have in the system...
    Comments added for better DB performance by: Arun Thangaraj

Maybe you are looking for

  • I'm confused...think the MBA had anything to do with this?

    Hiya, All righty...well, it's been about a week since I've had my MBA, and I have to say, this computer is awesome. However, I've had this very odd Internet problem and I'm not sure if it's the MBA'S fault--or, rather, my fault, given the way I used

  • Exception while a session been lookup on weblogic 10.3.3 using wlclient.jar

    Hi, I am upgrading to weblogic 10.3.3. I have a client that downloads the required to the client machines using Java web start 6. I am using wlclient.jar at the client side. When I am trying to lookup for a session bean it is throwing the below excep

  • ITunes 8: When downloading album artwork for making thumbnails, it quits?

    I just installed iTunes 8, and I tried opening it. It then starts to download the album artwork thumbnails, then all of a sudden a message shows saying, "iTunes has stopped working, Windows is trying to blablabla.." Then it forces you to closes the p

  • No Sound What So E

    I have no sound what so ever except for my Tower Beeping when there is supposed to be sound. I have tried to uninstall the driver and reinstall. Didnt work. Tried updating doesnt work. And when I try to update the driver it says its not installed. I

  • Transferring gallery from SD - E51

    Can anyone tell me how I can transfer the gallery stored on the SD card to the phone memory? Or, how do I view the gallery from the SD?