I just installed Oracle Database 11g R2 on Ubuntu.
I tried to run sqlplus but I got this message :
sqlplus: command not foundThese are the values of : $ORACLE_SID, $ORACLE_HOME and $PATH
aimad@localhost:/u01/app/oracle/product/11.2.0/dbhome_2/bin$ echo $ORACLE_SID
aimad@localhost:/u01/app/oracle/product/11.2.0/dbhome_2/bin$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_2/
aimad@localhost:/u01/app/oracle/product/11.2.0/dbhome_2/bin$ echo $PATH
/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/root/binHow can I solve this problem ?
Edit :
I tried to enter to the /u01/app/oracle/product/11.2.0/dbhome_2/bin and run the ./sqlplus command instead of sqlplus and it worked, but I want to execute sqlplus without entering to that path everytime.
2 Answers
The easiest solution for you I believe is to add a soft link in /bin to the actual location of the binary.
ln -s /u01/app/oracle/product/11.2.0/dbhome_2/bin/sqlplus /bin/sqlplus
This will allow all users to call sqlplus from wherever.
3You have many options here, but I will list what I believe to be the easiest/simplest.
Note: each of these is an independent solution. These do not compose a series of steps.
Locate the actual sqlplus binary and add that directory to your path. This relatively-ancient post is still extremely relevent for this task:askubuntu - how to add a directory to my path
Locate the binary and create a soft link to the bin directory in your user's home directory. Here is the command for that:
ln -s /u01/app/oracle/product/11.2.0/dbhome_2/bin/sqlplus $HOME/bin/sqlplusAlternatively for all users to have this functionality:
sudo ln -s /u01/app/oracle/product/11.2.0/dbhome_2/bin/sqlplus /usr/bin/sqlplusCreate an alias that calls the binary via its full path through environment variables. This tutorial gives you instructions for how to do that: askubuntu - How to create a permanent alias
The line for your alias would look like this:
alias sqlplus='/u01/app/oracle/product/11.2.0/dbhome_2/bin/sqlplus'Call the command directly by specifying the entire path every time:
/u01/app/oracle/product/11.2.0/dbhome_2/bin/sqlplus