17

I tried installing sqlplus by following the instruction from here. I'm still getting :

sqlplus: command not found

when I do sqlplus from my terminal.

I'm an novice in Ubuntu and I use Ubuntu 12.04.

  • I think you need to run the alien -i commands with sudo: sudo alien -i – Savvas Radevic Jul 5 '12 at 12:01
21

First of all you need to download Instant Client Downloads. Install alien package so you can install rpm packages by typing following command in terminal.

sudo apt-get install alien

Once that is done, go to the folder where the rpm files are located and execute the following:

sudo alien -i oracle-instantclient*-basic*.rpm
sudo alien -i oracle-instantclient*-sqlplus*.rpm
sudo alien -i oracle-instantclient*-devel*.rpm

You need to install libaio.so. Type following command to do it:

sudo apt-get install libaio1

Create Oracle configuration file:

sudo sensible-editor /etc/ld.so.conf.d/oracle.conf

Put this line in that file:

/usr/lib/oracle/<your version>/client/lib/ 

Note - for 64-bit installations, the path will be:

/usr/lib/oracle/<your version>/client64/lib/ 

Update the configuration by running following command:

sudo ldconfig

Try to connect using:

sqlplus username/password@//dbhost:1521/SID

or:

sqlplus testuser/password

Note that if you installed the 64-bit version, the client is called sqlplus64.

  • Thanks for the details. It helped me get the installation completed, especially the part about installing the lib. – lonstar Feb 7 '13 at 23:04
  • 1
    ...until I tried to run sqlplus testuser/password and got "sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory" – lonstar Feb 7 '13 at 23:08
  • 4
    ...and it was because I just touched the oracle.conf file and it turns out you need to add this to it: /usr/lib/oracle/11.2/client/lib/ (make sure to check that you actually have that path, and thanks to marcelozambranav.blogspot.com/2012/08/…). Once I did that, all was well. – lonstar Feb 7 '13 at 23:13
  • 3
    @K .K Patel I followed your instructions but after typing sqlplus in command line, it prompts to enter a username and password. And i do not know the username and password. What should i do? – Sabyasachi Aug 30 '14 at 8:30
  • They have oracle-instantclient* basic,devel,jdbc,odbc,sqlplus,tools,basiclite. Can't I just install the sqlplus one and be done with it? – masterxilo Nov 22 '18 at 16:51
2

The alien thing didn't work because of:

Error: cannot open Name index using db5 - Permission denied (13)

So I went with the easy solution: Download the zip files from Oracle (basic and sqlplus), extract them, and put the folder where you put program files (e.g. /usr/share). Then create a script that runs the executable after setting the LD_LIBRARY_PATH variable, so that libraries are found:

#!/bin/bash
DIR=/usr/share/instantclient_12_2 # <------- adjust this to the path you use
export LD_LIBRARY_PATH="$DIR"
"$DIR"/sqlplus "$@"

Call it sqlplus, make it executable (chmod 755 sqlplus) and put it into a directory on your PATH (e.g. /usr/bin/), so that bash finds it.

Run it like

sqlplus user/password@host:port/service

If you get

error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

install the library with sudo apt-get install libaio1

1

I think this link would help. It is pretty descriptive. Make sure you follow all the steps. Still if you have any problems, don't hesitate to comment.

  • 6
    Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Eliah Kagan Jul 5 '12 at 12:17
  • That what even I have done.. But it doesn't seem to be working.! – Ant's Jul 5 '12 at 12:41
  • I found this thread unix.com/ubuntu/157848-sqlplus-command-not-found.html.Try if this would help you any better. I don't have the net speed to download it, else i would have tried it myself and give a better solution. – Vinit Kumar Jul 5 '12 at 14:38
  • 1
    @Ant's "it's not working" does not provide us with clues. Show us the output of each command. Then we'll have a general picture of what's going on and where the problem is. – Savvas Radevic Jul 5 '12 at 22:12
0

Of course the correct installation is from official packages like above (download Instant Client Downloads), but you can get a full working sqlplus just by copying these files (you can found it in any computer with oracle client installed), and some msb are optitional:

./sqlplus
./sqlplus/mesg
./sqlplus/mesg/sp1zhs.msb
./sqlplus/mesg/sp2zhs.msb
./sqlplus/mesg/sp2ptb.msb
./sqlplus/mesg/sp2us.msb
./sqlplus/mesg/sp1us.msb
./sqlplus/mesg/sp1ptb.msb
./sqlplus/mesg/cpyja.msb
./sqlplus/mesg/sp1ja.msb
./sqlplus/mesg/cpyus.msb
./sqlplus/mesg/cpyzhs.msb
./sqlplus/mesg/cpyptb.msb
./sqlplus/mesg/sp2ja.msb
./sqlplus/sqlplus
./README
./lib
./lib/libaio.so.1
./lib/libclntsh.so.11.1
./lib/libsqlplus.so
./lib/libnnz11.so
./lib/libociei.so

As aditional dependency, I did include libaio.so - it can be installed with sudo apt-get install libaio1

So, a sample use can be:

cd <PATH_OF_FILES>
ORACLE_HOME=$PWD LD_LIBRARY_PATH=$PWD/lib ./sqlplus/sqlplus user/pw@server:PORT/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.