获取查询的运行时执行计划 [英] get runtime execution plan of a query

查看:83
本文介绍了获取查询的运行时执行计划的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个执行一些sql查询的应用程序.如何从sqlplus或其他Oracle客户端获取当前正在执行的查询的执行计划?如果有必要,我可以修改应用程序中使用的oracle会话.

I have an application that executes some sql queries. How can I get execution plan for currently executing query from sqlplus or some other oracle client? I can amend oracle session that is used in application, if that is necessary.

我不想使用explain plan并手动执行该查询,我需要获取用于查询的实际执行计划.

I do not want to use explain plan and execute that query by hand, I need to get actual execution plan that is used for query.

推荐答案

您可以对SGA的历史查询进行简单解释-

You can run explain plain on historical queries from the SGA -examples

并列出B.

示例:

SELECT username, prev_sql_id
FROM v$session
WHERE username = 'RDEVALL'  -- example user

SQL ID返回

RDEVALL a1d4z5ruduzrd
RDEVALL avmbutuknvb6j
RDEVALL 75g0tqd9x743y
RDEVALL 5fnkh6c8mqqt3
RDEVALL 75g0tqd9x743y

选择查询ID并在此处使用:

Pick query ID and use here:

SELECT *
  FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('a1d4z5ruduzrd')); -- replace with sql ID as needed

这篇关于获取查询的运行时执行计划的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆