我们在/home/oracle 下执行shell脚本登录数据库(sqlplus loginName/password)没有问题,但是在crontab下配置定时执行的时候往往会出现问题( sqlplus: command not found ) 这个时候就需要在shell脚本下面加入环境变量文件了,比如: source /home/oracle/.bash_profile . 以下是我执行存储过程的shell脚本,各位可以参考下
#!/bin/bash
source /home/oracle/.bash_profile
sqlplus loginName/password<<!;
exec login_createtab;
exit;