Sqlplus:找不到命令

Aom*_*iki 0 shell bash oracle-database

我有两台虚拟机ubuntu,一台是我安装oracle 11g express时的服务器,另一台是简单的客户端。我的目标是从客户端计算机远程运行 sql 查询。所以我准备了查询并将其发送到服务器。但是在下面的脚本中,建立到服务器的连接后,sqlplus不起作用。它向我显示了以下错误:

Sqlplus:找不到命令

在这项工作中,我使用了这个脚本:

#! /bin/bash

read -p "saisir votre requete: "  req

printf "%s\n" "$req" > t1.txt

sed -e 's/[;,()'\'']/ /g;s/  */ /g' t1.txt > t.txt

`tr -s '[[:blank:]]' '\n' < t.txt `|

  while IFS= read -r word; do

if ! [[ "$word" =~ $(echo ^\($(paste -sd'|' ./req.txt)\)$) ]]; then

var=$(base64 <<< $word)


sed -i -e "s/$word/$var/g" t1.txt
fi

  done

enter code here

scp requete.sql cloud1@1.0.0.1:/home/cloud1

#Conection to the Server

ssh cloud1@1.0.0.1 '/home/cloud1/Cloud-Serv'
Run Code Online (Sandbox Code Playgroud)

并且文件 Cloud-Serv 包含以下代码:

#! /bin/bash
"echo "Connection is done !"

sudo service oracle-xe start

sqlplus / as sysdba

exit
Run Code Online (Sandbox Code Playgroud)

Lam*_*ert 7

在大多数情况下,Oracle 实例在一个特殊帐户下运行,例如 oracle。如果您以该用户身份登录,您需要设置正确的环境,其中$ORACLE_BASE,$ORACLE_HOME$ORACLE_SID是最重要的。另外,PATH变量可以被扩展到具有$ORACLE_HOME/bin其中sqlplus通常居住。看看oraenv 设置正确的环境并尝试sqlplus使用$ORACLE_HOME/bin/sqlplus