暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

执行sql不打印输出查看执行计划

可以把sql写到脚本里,设置set term off,执行脚本就不打印输出了

[oracle@Centos8 ~]$ cat notprint.sql
set term off 

set arraysize 5000

alter session set current_schema=mdd;
set lines 200 pages 200
alter session set statistics_level=all;
set serveroutput off
select * from mdd where rownum<=1000;


[oracle@Centos8 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 11 18:36:26 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> @notprint
SQL> SELECT * FROM table(dbms_xplan.display_cursor('','','allstats last cost'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID csprtkzh1m66d, child number 0
-------------------------------------
select * from mdd where rownum<=1000

Plan hash value: 2574202476

--------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | Cost (%CPU)| A-Rows | A-Time | Buffers |
--------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | 3 (100)| 1000 |00:00:00.01 | 72 |
|* 1 | COUNT STOPKEY | | 1 | | | 1000 |00:00:00.01 | 72 |
| 2 | TABLE ACCESS FULL| MDD | 1 | 1000 | 3 (0)| 1000 |00:00:00.01 | 72 |
--------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

1 - filter(ROWNUM<=1000)


19 rows selected.

SQL> 

最后修改时间:2022-12-27 13:38:00
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论