获取Oracle sqlplus中SQL脚本的执行时间 [英] Get execution time of sql script in oracle sqlplus
本文介绍了获取Oracle sqlplus中SQL脚本的执行时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个脚本,用于将数据加载到Oracle中的表中(通过插入语句列表).我如何获得整个加载过程的执行时间?我已经尝试过使用set timing on
,但是这给了我每个插入语句的持续时间,而不是整个过程的持续时间.脚本如下所示:
I have a script that i use to load my data into my tables in Oracle (by a list of insert statements). How can i get the execution time of the entire loading process? I have tried with set timing on
, but that gives me a duration for each insert statement and not the entire process. The script is shown below:
spo load.log
prompt '**** load data ****'
set termout off
@@inserts.sql
commit;
set termout on
prompt '**** done ****'
spo off
exit;
推荐答案
尝试一下,在开头添加以下内容,它会记住当前时间:
Try this, add the following at the beginning and it remembers the current time:
set serveroutput on
variable n number
exec :n := dbms_utility.get_time
在末尾添加它,并计算经过的时间:
Add this at the end and it calculates the time elapsed:
exec :n := (dbms_utility.get_time - :n)/100
exec dbms_output.put_line(:n)
这篇关于获取Oracle sqlplus中SQL脚本的执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文