Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SET TIME ON in SQL*Plus does not print current time

Peter7737 hours ago — edited 20 hours ago

DB version:19.11
SQL*Plus version: 19.11
OS: RHEL 8.10

I have an SQL script like below which has both SET TIME ON and SET TIMING ON.
But, during the execution of the script, both in the spooled log and on the screen output, the time is not printed.
I was hoping that the current time will get printed after every index creation.

$ cat create_indexes_mia.sql

alter session set current_Schema = D00SKU_MST;

set time on
set timing on

spool createIndexes_mst.log

CREATE INDEX xyz on table abc (col1, col2) TABLESPACE MST_INDEX_LS online;
CREATE INDEX xxx on table vvx (col1, col2) TABLESPACE MST_INDEX_LS online;
CREATE INDEX svb on table gmr (col1, col2) TABLESPACE MST_INDEX_LS online;
CREATE INDEX efg on table nck (col1, col2) TABLESPACE MST_INDEX_LS online;

spool off;

And spooled log file is like below. The timing (duration) is printed. But, current time is not printed at all.

$ cat createIndexes_mst.log

Index created.

Elapsed: 00:00:05.23

Index created.

Elapsed: 00:14:34.31

Index created.

Elapsed: 00:01:43.85

Index created.

Elapsed: 00:00:04.74

In the screen (terminal) output, it is very similar behavior. Except that, after the last command (create index) is executed, the time gets printed. As shown below for 17:55:03

SQL> !ls -l
total 4
-rw-r--r--. 1 oracle oinstall 1115 Jul 17 17:34 create_indexes_mst.sql

SQL> @create_indexes_mst.sql

Session altered.

Index created.

Elapsed: 00:00:05.23

Index created.

Elapsed: 00:14:34.31

Index created.

Elapsed: 00:01:43.85

Index created.

Elapsed: 00:00:04.74
17:55:03 SQL>

This is not the expected behaviour. Right ? Anyway, how I can get the time also printed after each index creation ?

Comments
Post Details
Added 37 hours ago
2 comments
24 views