Oracle SQL Query plan for an executed query
Sometimes you want to check the query plan that your app executed it. In such case, you cannot use an SQL editor to get the plan. What you can do is to find sql_id of your query and check the plan that is stored in the DB.
select sql_id, sql_text
from v$sql
where sql_text like '%AND MY_ID%';
Where "AND MY_ID" is as unique part of your query as possible. Once you found it, copy "SQL_ID" and paste it in the next query.
select plan_table_output
from table(dbms_xplan.display_cursor('9tvx270mmh44t',null));
Where "9tvx270mmh44t" is ID copied from the previous query.
References:
http://www.dba-oracle.com/t_sql_execution_plan_finished_query.htm
https://docs.oracle.com/database/121/ARPLS/d_xplan.htm#ARPLS378
- Previous: PL/SQL script with memory leak
- Next: NPM Shell