【问题标题】:Attempting to connect to an oracle database from shell script尝试从 shell 脚本连接到 oracle 数据库
【发布时间】:2015-03-26 14:39:15
【问题描述】:

我正在尝试从 shell 脚本连接到 oracle 数据库(我是新用户)。然后该脚本将传递一个查询并将结果传输到一个名为 canadacount 的变量。我已经写了代码,但它不起作用

#this script will attempt to connect to a remote database CFQ143 with user ID 'userid' and password 'password'.
#After loggin in it will read data from the PLATFORMSPECIFIC table.
#We can pass a query 'select count (platform) from platformspecific where platform='CANADA';
#The result from this query will be passed to a variable called canadacount which we can then echo back to the user.

canadacount='$ORACLE_HOME/bin/sqlplus -s /nolog<<EOF
connect userid/passsword@CFQ143:1521:CFQ143
set pages 0 feed off
select count (platform) from platformspecific where platform='CANADA';
exit
EOF'
echo $canadacount

【问题讨论】:

  • “它不起作用”的表达在这里很完美。那只是在屏幕上吐出文字,不会运行。
  • 你想说什么
  • 非常有趣的弗洛林...可能对你很幽默,但对我来说不是

标签: oracle shell unix


【解决方案1】:

答案是:

我把连接线改成如下:

connect userid/passsword@CFQ143

【讨论】:

    猜你喜欢
    • 2022-11-23
    • 2012-05-03
    • 2015-11-27
    • 1970-01-01
    • 2021-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多