简体   繁体   English

Bash sqlplus连接不是来自root

[英]Bash sqlplus connection not from root

i would like to connect from bash script and execute some procedures on ORACLE. 我想从bash脚本连接并在ORACLE上执行一些过程。

su - oracle -c "sqlplus -s /nolog <<EOF connect test/test execute SCHEMA.PCG_TEST.P_PROCEDURE; EOF"

it works when do this on root, but i want to start script not from root. 它在根上执行此操作时有效,但我想不从根启动脚本。 How to do this ? 这个怎么做 ?

If you connect from the cron or something like it, probably sqlplus is not known. 如果您从cron或类似的站点进行连接,则可能未知sqlplus。 So you have to set some environment variables or you have to call the entire path: 因此,您必须设置一些环境变量,或者必须调用整个路径:

$ORACLE_HOME/bin/sqlplus

That way it should work 这样就可以了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM