gpt4 book ai didi

Oracle/SQL PLUS : How to spool a log and write intermittently throughout script

转载 作者:行者123 更新时间:2023-12-02 08:34:26 24 4
gpt4 key购买 nike

弄清楚如何假脱机到文件已经很容易了。我希望在写入每个命令后有一个选项可以写入文本文件。我不确定如何向团队中的其他人传达长脚本的状态。我们寻求的解决方案是将日志文件写入网络驱动器,当脚本执行时,它们将能够跟进。

但是,这似乎只在假脱机关闭后将输出写入文件;命令位于文件末尾。

有什么方法可以实现我们想要做的事情,无论是通过假脱机日志文件还是其他方法?

这是我到目前为止的代码。

set timing on;
set echo on;

column date_column new_value today_var
select to_char(current_timestamp, 'yyyymmdd_HH24_MI') as date_column
from dual
/
select current_timestamp from dual;

SPOOL 'Z:\log\KPI\secondary_reporting_&today_var..log'

... lots of stuff...
spool off;

最佳答案

据我所知,无法控制何时将假脱机输出写入文件。不过,解决这个问题的一种方法可能是完全放弃假脱机并仅重定向输出:

$ sqlplus @/path/to/script.sql >& /path/to/script.log

关于Oracle/SQL PLUS : How to spool a log and write intermittently throughout script,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34400319/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com