在 Oracle 11g 中获取实际执行计划

2021-12-30 00:00:00 sql oracle11g oracle toad

我已阅读此帖子和这个 优秀文章

I have read this post and this excellent article

我的问题是,如何在 Oracle 11g 中获取实际执行计划

My question is, how to get the acutual execution plan in Oracle 11g

没有 sys 权限和 DBA 权限.(您可以将我的案例视为只读用户)

without sys privilege and DBA privilege. (You can treat my case as a READ-ONLY user)

我可以在 TOAD 中使用 SYS.PLAN_TABLE$CTRL+E 获得解释计划>

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?

在 Oracle 的文档中找到

Found on Oracle's Document

执行计划可能因以下原因而有所不同:

Execution plans can differ due to the following:

  • 不同的架构

  • 不同的费用

  • 请给我任何你能提供的帮助来澄清我的概念.

    Please give me any help you can offer to clear my concepts.

    推荐答案

    如果你想使用 dbms_xplan.display_cursor,你需要 至少有这些资助:

    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;
    

    而且您可能还需要 V$SQL 来查找 SQL_ID:

    And you'll probably also need V$SQL to find the SQL_ID:

    grant select on sys.v_$sql to larry;
    

相关文章