在升级版本到11.7之后,部分在11.3上正常执行的SP开始报错,报的SQL错误是时间参数问题,但是一样的SP可以直接call sp执行,也可以手动调用作业执行,只有设置定时调度时作业会报错,
CALLXXX.XXX(1,CURRENT TIMESTAMP,CURRENT TIMESTAMP,DB2ETL.P_OUT_SQLCODE,DB2ETL.P_OUT_ERRMSG,DB2ETL.P_OUT_MD5)
DS_FA_PRECONT_SP: SQLExecDirect() 报告:SQLSTATE = 22007: 本机错误代码 = -180: 消息 = [IBM][CLI Driver][DB2/LINUXX8664] SQL0180N The syntax of the string representation of a datetime value is incorrect. SQLSTATE=22007 (CC_DB2Adapter::handleBeforeAfterSQL, file CC_DB2Adapter.cpp, line 2,587)
一开始就怀疑传参数有问题了,但是手工执行没问题,配置成crontab就不行,经过思考,crontab默认是不加载环境变量,是否因为环境变量问题才会有这种报错,
具体crontab命令如下,
*/5 * * * 1,2,3,4,5,6,0 /opt/IBM/InformationServer/Server/Projects/dstage1/dsr_sched.sh /opt/IBM/InformationServer/Server/Projects/dstage1 /opt/IBM/InformationServer/Server/DSEngine xxx_xxx_xx_xxx_15MIN 0/50/1/0/0/0/0/ 3 >/dev/null 2>&1 #DSjobDS DSJ.dstage1.10947.3
查看dsr_sched.sh
发现没有加载用户的profile
将用户.bash_profile添加在脚本里source下,重启crontab调度作业正常。
source /home/dsadm/.bash_profile