1. 程式人生 > >crontab中執行shell登入資料庫

crontab中執行shell登入資料庫

我們在/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;