get runtime execution plan of a query

前端 未结 1 542
野的像风
野的像风 2020-12-17 01:36

I have an application that executes some sql queries. How can I get execution plan for currently executing query from sqlplus or some other oracle client? I can amend oracle

相关标签:
1条回答
  • 2020-12-17 02:40

    You can run explain plain on historical queries from the SGA -examples

    And listing B.

    Example:

    SELECT username, prev_sql_id
    FROM v$session
    WHERE username = 'RDEVALL'  -- example user
    

    SQL ID returned

    RDEVALL a1d4z5ruduzrd
    RDEVALL avmbutuknvb6j
    RDEVALL 75g0tqd9x743y
    RDEVALL 5fnkh6c8mqqt3
    RDEVALL 75g0tqd9x743y
    

    Pick query ID and use here:

    SELECT *
      FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('a1d4z5ruduzrd')); -- replace with sql ID as needed
    
    0 讨论(0)
提交回复
热议问题