简体   繁体   English

找不到bash sqlplus命令

[英]bash sqlplus command not found

I am trying to install sqlplus on my mac following the tutorial here: https://tomeuwork.wordpress.com/2014/05/12/how-to-install-oracle-sqlplus-and-oracle-client-in-mac-os/comment-page-1/#comment-6 我正在尝试按照此处的教程在Mac上安装sqlplus: https : //tomeuwork.wordpress.com/2014/05/12/how-to-install-oracle-sqlplus-and-oracle-client-in-mac- OS /评论页-1 /#评论-6

I have downloaded the two packages (basic and sqlplus) and created all the directories as it says, I moved the necessary files inside the directories. 我已经下载了两个软件包(基本软件包和sqlplus软件包)并按其说明创建了所有目录,然后将所需文件移入了目录中。 I created and copied the tnsnames.ora file with the contents: 我创建并复制了tnsnames.ora文件,其内容如下:

MYDB=

 (DESCRIPTION=

(ADDRESS=

  (PROTOCOL=TCP)

  (HOST=*********)

  (PORT=1521)

)

(CONNECT_DATA=

  (SERVER=dedicated)

  (SID=MYDB-SID)

)  )

And i created the .bash_profile as it says in the tutorial. 我按照教程中的说明创建了.bash_profile。

But what im stuck on is making the sqlplus run. 但即时通讯卡住了是使sqlplus运行。

typing in sqlplus returns command not found. 在sqlplus中键入将返回找不到命令。

in the tutorial it says i should use $ sqlplus username/password@database 在教程中说我应该使用$ sqlplus username/password@database

where do i get the username and database name from?, I haven't created one yet. 我从哪里获得用户名和数据库名?,我还没有创建。

Thanks in advance. 提前致谢。

According to your article, you should do the following: 根据您的文章,您应该执行以下操作:

$ vi ~/.bash_profile 
Add the following line to the end of the file.
alias sqlplus=’rlwrap sqlplus’ 
Now reload the .bash_profile: 
$ source ~/.bash_profile

Looks like you missed these steps. 您似乎错过了这些步骤。

You can try to execute: 您可以尝试执行:

$rlwrap sqlplus

According to the comments below you do not have sqlplus in the $PATH. 根据下面的注释,您在$ PATH中没有sqlplus。 The value of $PATH looks wrong to me: duplicates, quotes. $ PATH的值对我来说似乎是错误的:重复,引号。

Option 1 选项1

Execute: 执行:

export PATH=/Applications/‌​or‌​acle/product/instantclient_64/11.2.0.4.0/bin:/usr/local/bin:/usr/bin:/bin:/us‌​r/s‌​bin:/sbin

Then execute in the same console: 然后在同一控制台中执行:

$ sqlplus (or $ rlwrap sqlplus)

It will set value only for the current shell. 它将仅为当前外壳设置值。 The main idea is to have full path to the sqlplus binary in the $PATH. 主要思想是在$ PATH中具有sqlplus二进制文件的完整路径。

Option 2 选项2

Modify ~/.bash_profile . 修改~/.bash_profile To save as a permanent environment variable edit ~/.bash_profile . 要保存为永久环境变量,请编辑~/.bash_profile There are some details about setting PATH in the source article. 在源文章中有一些有关设置PATH的详细信息。

Top down troubleshooting approach 自上而下的故障排除方法

Look for binary - use type 寻找二进制文件-使用类型

[bbrandt] ~/ $ type sqlplus
sqlplus is aliased to `rlwrap sqlplus'

Where is my binary.. hidden behind an alias, let's unalias 隐藏在别名后面的我的二进制文件在哪里,让我们保持别名

[bbrandt] ~/ $ unalias sqlplus
[bbrandt] ~/ $ type sqlplus
 sqlplus is /u01/app/oracle/product/11.2.0/xe/bin/sqlplus

Found it! 找到了! What happens if I modify my binary search-path? 如果修改二进制搜索路径会怎样?

[bbrandt] ~/ $ echo $PATH
/u01/app/oracle/product/11.2.0/xe/bin:/home/bbrandt/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin
[bbrandt] ~/ $ export PATH=/home/bbrandt/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin

Now, where is my binary? 现在,我的二进制文件在哪里?

[bbrandt] ~/ $ type sqlplus
bash: type: sqlplus: not found
[bbrandt] ~/ $ 

This is where you are... look in your $PATH variable 这就是您的位置...查看$ PATH变量

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

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