1.在执行查询的sql前加上 explain plan FOR

例如:explain plan FOR select sysdate from dual;

2.查看生成的执行计划

select plan_table_output from TABLE(DBMS_XPLAN.DISPLAY(‘PLAN_TABLE’));

 注意:以上两步需要在同一个窗口下运行否则会报错:

Error: cannot fetch last explain plan from PLAN_TABLE