sqlplus无法从shell脚本执行,但是可以从终端执行正常

时间:2018-10-12 15:54:20

标签: oracle shell sqlplus

我有一个运行Shell脚本的软件。该shell脚本中还有一个sqlplus命令以及其他许多人员。

sqlplus -L 'user/passwd'@\'localhost:1521/orcl\' @file_path.ddl test_cpm_user test_cpm_password CPMDAT CPMIDX

Shell脚本在上一行失败,并显示以下消息:

SQL*Plus: Release 11.2.0.4.0 Production on Fri Oct 12 11:50:36 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified


SP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus

但是,如果我自己在终端上运行它,则效果很好。 这种行为可能是什么原因?

1 个答案:

答案 0 :(得分:0)

尝试以下命令并使用大括号,因为我看到主机名包含特殊字符

sqlplus -L'{user} / {passwd}'@ {hostname}'@ file_path.ddl test_cpm_user test_cpm_password CPMDAT CPMIDX

相关问题