从V$SQL_PLAN中FORMAT执行计划

10G版本

select sql_id from v$sqlarea where sql_text like'%xxx%';

select  * from v$sql_plan where sql_id=&sql_id;

select * from table(dbms_xplan.DISPLAY_cursor('&sql_id'));

example:

select * from table(dbms_xplan.DISPLAY_CURSOR('gnuk7vymvn01s'));
 
PLAN_TABLE_OUTPUT
——————————————————————————–
SQL_ID  gnuk7vymvn01s, child number 0
————————————-
SELECT SUBSTR(BANNER,INSTR(BANNER,'Release',1)+8,2) FROM V$VERSION
WHERE ROWNUM=1
Plan hash value: 1517457201
——————————————————————–
| Id  | Operation         | Name      | Rows  | Bytes | Cost (%CPU)|
——————————————————————–
|   0 | SELECT STATEMENT  |           |       |       |     1 (100)|
|*  1 |  COUNT STOPKEY    |           |       |       |            |
|*  2 |   FIXED TABLE FULL| X$VERSION |     1 |    47 |     0   (0)|
——————————————————————–
Predicate Information (identified by operation id):
—————————————————
   1 – filter(ROWNUM=1)
   2 – filter("INST_ID"=USERENV('INSTANCE'))
 
PLAN_TABLE_OUTPUT
——————————————————————————–

原文地址:https://www.cnblogs.com/travel6868/p/5039244.html