Get a query execution plan

I have an application that executes some sql queries. How can I get an execution plan to execute the current query from sqlplus or another oracle client? I can change the oracle session that is used in the application if necessary.

I do not want to use explain planand execute this request manually, I need to get the actual execution plan that is used for the request.

+5
source share
1 answer

You can run plain explanation on historical queries from SGA - examples

And listing B.

Example:

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

SQL id is returned

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

Select a request id and use here:

SELECT *
  FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('a1d4z5ruduzrd')); -- replace with sql ID as needed
+10
source

All Articles