我正在使用 root 登录到 linux 机器,登录后我使用 su - oracle 连接我的数据库。现在我有 2 个 shell 脚本,一个在 root home,一个在 home/oracle。在 home/oracle 中,我编写了一个用于备份数据库的脚本。 root 中可用的脚本是 nohup ssh oracle@onprem-svcdb/home/oracle/test.sh 在运行脚本时询问 oracle 的密码,我不需要它在运行脚本时像这样它不需要' 需要询问密码,它需要在 oracle 中运行脚本。我需要为此做什么???任何人都可以帮忙吗
最佳答案
如果我正确理解,您会在使用连接到您的数据库并执行某些操作的脚本时收到密码提示。如果你不需要密码提示,你需要在你的 linux 机器上为登录用户生成 ssh 的公钥和私钥,并在数据库中配置它。请查看以下链接
http://docs.oracle.com/cd/E19253-01/816-4557/sshuser-33/index.html
你可以试试下面的方法
Let this be you env variables.
---------VARIABLES --------------
export APP_USER=something
export APP_PASS=somepass
export APP_SID=sid
Here is the script with a execute permission.
--------------SCRIPT TO RUN SQL----------
#!/usr/ksh
sqlplus << END_OF_SQL
$APP_USER/$APP_PASS@APP_SID
select * from dual;
END_OF_SQL
exit $?
----------END SCRIPT----------
来源:https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:142212348066
关于linux - 从 root 运行一个脚本,它调用 sudo oracle 中的另一个脚本。如何在不询问 oracle 密码的情况下做到这一点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31286184/