有没有办法让sqlplus可以打印它执行的语句.
我的意思是我有一些我在bash脚本中运行的.sql文件.我需要知道什么时候我读取日志文件sqlplus运行的语句.
例:
说我有这个test.sql文件:
set timing on
create table foo (a varchar2(10));
create table bar (b varchar2(10));
exit
当我检查日志时,我得到了这个:
Table created.
Elapsed: 00:00:00.02
Table created.
Elapsed: 00:00:00.01
哪个不提供信息.有没有办法让我得到这样的输出:
Table foo created.
Elapsed: 00:00:00.02
Table bar created.
Elapsed: 00:00:00.01
或者甚至像这样:
create table foo (a varchar2(10));
Table created.
Elapsed: 00:00:00.02
create table bar (b varchar2(10));
Table created.
Elapsed: 00:00:00.01
我知道我可以在每个语句之前使用PROMPT,但是我有大的sql脚本,在每个语句之前编写PROMPT会很繁琐.
编辑:
对于Allan的解决方案始终工作(即使用“set echo on”),您应该避免以下情况:
1)不要在sqlplus中使用-S选项,因为这会抑制命令回显的显示.
2)不要将你的脚本“cat”到sqlplus,如下所示:
cat test.sql | sqlplus scott/tiger@orcl