2015-02-24 58 views
0

我想教程這裏下我的Mac上安裝的sqlplus:https://tomeuwork.wordpress.com/2014/05/12/how-to-install-oracle-sqlplus-and-oracle-client-in-mac-os/comment-page-1/#comment-6的bash sqlplus的命令

我已經下載了兩個包(基本和SQLPLUS)和它說創造了所有的目錄,我感動目錄中必需的文件。 我創建和複製與內容tnsnames.ora文件:

​​

而且我創建了.bash_profile文件,因爲它在教程說。

但是我堅持的是讓sqlplus運行。

在sqlplus中輸入返回命令未找到。

教程

它說我應該使用$ sqlplus username/[email protected]

我在哪裏可以從?我沒有創建一個獲取用戶名和數據庫的名字呢。

在此先感謝。

+0

就個人而言,我會在發出命令「的sqlplus用戶名@數據庫」的習慣,並讓sqlplus的提示我的密碼。此外,許多示例都使用scott/tiger Oracle數據庫運行,因此您可以在這種情況下使用這些憑據。 – unigeek 2015-02-24 21:04:57

回答

3

根據您的文章,您應該做到以下幾點:

$ 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 

貌似你錯過了這些步驟。 你可以嘗試執行:

$rlwrap sqlplus 

按照下面的評論你沒有SQLPLUS在$ PATH。 $ PATH的值對我來說看起來不對:重複,引號。

選項#1。執行:

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 

然後在同一控制檯執行:

$ sqlplus (or $ rlwrap sqlplus) 

它只會爲當前shell設置值。主要思想是在$ PATH中有完整路徑到sqlplus二進制文件。

選項#2。修改〜/ .bash_profile。 要保存爲永久環境變量,請編輯〜/ .bash_profile。源文章中有關於設置PATH的一些細節。

+0

我完成了這個額外的步驟,並嘗試'$ rlwrap sqlplus',但我得到:_-bash:sqlplus:命令not found_ – al3 2015-02-24 22:10:28

+0

然後問題可能與您的$ PATH變量。根據下面的評論,你有一些額外的報價。打開控制檯並執行export PATH =/Applications/oracle/product/instantclient_64/11.2.0.4.0/bin:/ Applications /或acle/product/instantclient_64/11.2.0.4.0/bin:/ usr/local/bin:/ usr/bin:/ bin:/ usr/s bin:/ sbin然後在同一控制檯執行sqlplus或rlwrap sqlplus。 – idobr 2015-02-24 22:58:20

+0

好吧,工作,如在sqlplus命令,但它說dyld:庫未加載和sqlplus崩潰。你可以看看這個截圖嗎? http://postimg.org/image/hav4gttlj/ – al3 2015-02-24 23:35:00

1

自上而下的故障排除方法

查找二進制 - 使用

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

哪裏是我的二進制..隱藏別名背後,讓我們unalias

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

找到了!如果我修改我的二進制搜索路徑會怎麼樣?

[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 

現在,我的二進制文件在哪裏?

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

這是你在哪裏......看着你的$ PATH變量

+0

這是我的$ PATH變量'〜$ echo $ PATH 「/Applications/oracle/product/instantclient_64/11.2.0.4.0"/bin:"/Applications/oracle/product/instantclient_64/11.2.0.4.0"/ bin:/ usr/local/bin:/ usr/bin:/ bin:/ usr/sbin:/ sbin如何更改它?不知道爲什麼我在那裏得到引號「 – al3 2015-02-24 21:54:27