解析:如何获取或记录Oracle语句执行时间

来源:岁月联盟 编辑:zhuzhu 时间:2007-09-19

很多情况下我们需要获取或记录Oracle语句执行时间,其实简单的方法就能实现,具体代码如下:

OracleE语句的执行时间需要使用 SET TIMING ON,例如:

[oracle@jw ~]$ sqlplus "/as sysdba"SQL*Plus: Release 9.2.0.4.0 - Production on 星期二 8月 28 16:59:43 2007Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

连接到:

Oracle9i Enterprise Edition Release 9.2.0.4.0 - ProductionWith the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining optionsJServer Release 9.2.0.4.0 - ProductionSQL> set timing on;SQL> select count(*) from tab;COUNT(*)----------2447已用时间: 00: 00: 00.12SQL>