Ubuntu: sqlplus: command not found on Ubuntu



Question:

I just installed Oracle Database 11g R2 on Ubuntu.

I tried to run sqlplus but I got this message :

sqlplus: command not found  

These 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/bin  

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


Solution:1

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.


Solution:2

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

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

  2. 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/sqlplus  

    Alternatively for all users to have this functionality:

    sudo ln -s /u01/app/oracle/product/11.2.0/dbhome_2/bin/sqlplus /usr/bin/sqlplus  


  3. Create 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'  


  4. Call the command directly by specifying the entire path every time:

    /u01/app/oracle/product/11.2.0/dbhome_2/bin/sqlplus  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »