问题
I have read this post and this excellent article
My question is, how to get the acutual execution plan in Oracle 11g
without sys privilege and DBA privilege. (You can treat my case as a READ-ONLY user)
I'm able to get the explain plan using SYS.PLAN_TABLE$
or CTRL+E in TOAD
But my understanding is that explain plan = estimated execution plan only?
Found on Oracle's Document
Execution plans can differ due to the following:
Different Schemas
Different Costs
Please give me any help you can offer to clear my concepts.
回答1:
If you want to use dbms_xplan.display_cursor
, you'll need at least these grants:
grant select on sys.v_$sql_plan to larry;
grant select on sys.v_$session to larry;
grant select on sys.v_$sql_plan_statistics_all to larry;
And you'll probably also need V$SQL
to find the SQL_ID
:
grant select on sys.v_$sql to larry;
回答2:
If you're developer, maybe I can request SELECT_CATALOG_ROLE to be granted you. In 11g it is harmless to grant it. This will allow read-only access to most of the information DBAs have.
This will give you an access to v$sql_plan*, v$session_longops, V$lock, V$SQL_BIND_CAPTURE and other performance related data.
来源:https://stackoverflow.com/questions/14596088/getting-actual-execution-plan-in-oracle-11g