crontab調用shell訪問Oracle問題

來源:互聯網
上載者:User

使用shell調用sqlplus訪問Oracle直接執行沒問題。但是使用crontab調用時由於環境變數不生效,會不認為sqlplus為有效命令。

註:調用時使用的Oracle使用者
 
解決方案一:
在shell調用入口處增加如下環境變數:
export ORACLE_BASE=/oracle;
export ORACLE_HOME=$ORACLE_BASE/app/product/9.2.0;
export ORACLE_SID=COGNOS;
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;
export PATH=$PATH:/usr/bin:sbin:/usr/sbin:/usr/contrib/bin:$ORACLE_HOME/bin

解決方案二:
直接添加profile到shell程式入口處,即
. /oracle/.profile 

解決方案三:
在crontab指名啟動並執行oracle使用者名稱

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.