[20260903]sqlplus timing命令.txt
--//sqlplus 除了set timing on命令,还有1个timing命令设置多个命令一起执行需要多时间。通过简单例子说明问题。
1.环境:
SCOTT@book01p> @ ver2
==============================
PORT_STRING : x86_64/Linux 2.4.xx
VERSION : 21.0.0.0.0
BANNER : Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
BANNER_FULL : Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
BANNER_LEGACY : Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
CON_ID : 0
PL/SQL procedure successfully completed.
2.测试:
$ head -4 d_5_1.txt ; echo ;tail -4 d_5_1.txt ; wc d_5_1.txt
variable b00001 number ;
variable b00002 number ;
variable b00003 number ;
variable b00004 number ;
variable b19997 number ;
variable b19998 number ;
variable b19999 number ;
variable b20000 number ;
20000 80000 500000 d_5_1.txt
--//定义变量的命令并非sql语句。设置set timing on并不会出现执行时间计时功能。
SCOTT@book01p> set timing on
SCOTT@book01p> @ d_5_1.txt
SCOTT@book01p> set timing off
SCOTT@book01p> help timing
TIMING
------
Records timing data for an elapsed time period, lists the current
timer's name and timing data, or lists the number of active timers.
TIMI[NG] [START text|SHOW|STOP]
$ cat dd.txt
timing start
@ d_5_1.txt
timing stop
SCOTT@book01p> @ dd.txt
Elapsed: 00:00:11.18
--//当然如果手工键入这些命令也算时间,写成脚本计算执行时间比较精确。
--//比我以前写脚本来计算时间要简单许多。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-3181645/ ,如需转载,请注明出处,否则将追究法律责任。