【问题标题】:Cronjob not process properlyCronjob 无法正确处理
【发布时间】:2018-04-20 07:15:07
【问题描述】:

我创建了一个脚本来收集我的 oracle 12c 数据库的统计信息并授予执行权限。一旦我执行了脚本,它就可以正常工作。但是,如果我通过 cronjob 执行它,它就不会按预期工作。仅更新日志文件的日期,其中没有任何内容作为脚本的正常执行。 cron 作业失败的原因是什么

脚本和cron作业如下

sqlplus / as sysdba <<EOF

exec dbms_stats.gather_schema_stats('SIEBEL');

exit;

EOF

定时任务

19 12 * * * /export/home/oracle/amalw/stat_gather.sh > /export/home/oracle/amalw/stat_gather.log

db.env 配置文件位于 /export/home/oracle 位置

【问题讨论】:

标签: sql oracle cron


【解决方案1】:

Redirect the error output 使用2&gt;&amp;1 到您的日志文件中:

 19 12 * * * /export/home/oracle/amalw/stat_gather.sh \
     > /export/home/oracle/amalw/stat_gather.log 2>&1

或者通过添加到 crontab 的顶部告诉 crond 到 mail you:

MAILTO=you@gmail.com

【讨论】:

    猜你喜欢
    • 2016-08-21
    • 2012-07-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-19
    • 2017-09-10
    • 2017-08-04
    相关资源
    最近更新 更多