How to check Oracle database for long running queries

前端 未结 8 1773
半阙折子戏
半阙折子戏 2020-12-02 04:03

My application, which uses an Oracle database, is going slow or appears to have stopped completely.

How can find out which queries are most expensive, so I can inves

8条回答
  •  伪装坚强ぢ
    2020-12-02 04:47

    You can check the long-running queries details like % completed and remaining time using the below query:

     SELECT SID, SERIAL#, OPNAME, CONTEXT, SOFAR, 
     TOTALWORK,ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE" 
     FROM V$SESSION_LONGOPS 
     WHERE OPNAME NOT LIKE '%aggregate%' 
           AND TOTALWORK != 0 
           AND SOFAR <> TOTALWORK;
    

    For the complete list of troubleshooting steps, you can check here:Troubleshooting long running sessions

提交回复
热议问题