al3
al3

Reputation: 104

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

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. I created and copied the tnsnames.ora file with the contents:

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.

But what im stuck on is making the sqlplus run.

typing in sqlplus returns command not found.

in the tutorial it says i should use $ sqlplus username/password@database

where do i get the username and database name from?, I haven't created one yet.

Thanks in advance.

Upvotes: 2

Views: 46279

Answers (2)

idobr
idobr

Reputation: 1647

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. The value of $PATH looks wrong to me: duplicates, quotes.

Option 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.

Option 2

Modify ~/.bash_profile. To save as a permanent environment variable edit ~/.bash_profile. There are some details about setting PATH in the source article.

Upvotes: 3

Bjarte Brandt
Bjarte Brandt

Reputation: 4461

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

Upvotes: 4

Related Questions