The process is not so complicated. So let's start first you need to go to the Database Instant Client page and download the one specific to your platform. This post is for 32 bit so you have to download the Instant Client Downloads for Linux x86 one. It should be the same for the 54 bit though. From there you need to download these 2 rpm files:
- Instant Client Package - Basic: All files required to run OCI, OCCI, and JDBC-OCI applications
- Instant Client Package - SQL*Plus: Additional libraries and executable for running SQL*Plus with Instant Client
- Instant Client Package - SDK: Additional header files and an example makefile for developing Oracle applications with Instant Client
sudo apt-get install alien
Once that is done, go to the folder where the rpm files are located and execute the following
alien -i oracle-instantclient-basic*.rpm alien -i oracle-instantclient-sqlplus*.rpm alien -i oracle-instantclient-devel*.rpm
These commands will convert the rpm files on the fly and install them. Now you can test it by just typing sqlplus on the command line. For sure it will complain about a couple of things. One of them maybe about a missing libaio.so.1 . This one is easy, we just need to install it a simple
sudo apt-get install libaio1The next error might be about missing libraries like libsqlplus.so. The libraries are there but SQL Plus can't find them. We need to add them to our PATH this is easy as well. We just need to create an oracle.conf file inside /etc/ld.so.conf.d/ so lets do that. I use vi because I like it, but you can use whichever editor you want to create the file.
sudo vi /etc/ld.so.conf.d/oracle.confthen we add this:
/usr/lib/oracle/11.2/client/lib/Notice that in my path I have 11.2 be careful with this. You can navigate and check that the path is correct for yours. 11.2 is the version we are installing. At the time of this post 11.2 was the latest one. Once you save the file we need to update the configuration by running:
sudo ldconfig
Now you should be ready to connect using:
sqlplus username/password@//dbhost:1521/SID
If you have problems with the SDK, you can check this post.
Hope it helps someone and happy coding!
nice post. bt i can't login. plz help.
ReplyDeleteWhat is the username and password?
Can you be more specific?
ReplyDeleteHow do you create a new user and password to log in using sqlplus ?
ReplyDeleteAt the beginning you have to log in using the sys user something like this:
ReplyDeletesqlpus sys/[youpassword] as sysdba
then create a user
create user testuser identified by "password";
then you can do:
sqlplus testuser/password
What is [youpassword] ?? I was never asked a password during installation
Deletehi, thank you for this helpful tutorial, i have a problem with username and pass, i used "sys" as user name and "sysdba" as password, but not working. can you pleas help me with that .
Deletethanks again
Hi,
ReplyDeleteit is a nice post, thank you.
I did all the steps you described, and no error message have been diplayed. But at the final step:
" sqlplus username/password@//dbhost:1521/SID "
the terminal displays that:
sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory
Have you any idea about how to fix this?
Thanks
It's probably because the LD_LIBRARY_PATH was not set up. See the part about creating an oracle.conf file in the /etc/ld.so.conf.d directory. That should fix things for you.
Deletein order to solve this problem, type this comand sudo apt-get install libaio1 works fine to me.
DeleteVery nice set of instructions. Thx!
ReplyDeleteWorks great, thanks!
ReplyDeleteHi, very helpful, but Can u tell me how to connect to the HR schema so that I can excute my queries on the already created tables in HR schema.
ReplyDeleteThank you.
i have done all the above steps but when i type sqlplus in my terminal it is saying no command found
ReplyDeleteGreat job Marcelo...
ReplyDeleteWorking perfectly 32/64 bit Ubuntu and 12.1 oracle instant client too...
Just changing the path to the libraries (/usr/lib/oracle/12.1/client64/lib)
Thanks
Norberto.cintio@gmail.com
Hi, nice method of installation of Sql Plus on Ubuntu Os.I extremely helped in installing Sql Plus in Os.Thanks....
ReplyDelete-Aparna
Theosoft
Nice Post Bro, You solved my Problem. Really Very Helpful Post thanks a lot
ReplyDeleteC Projects
How can I access and manipulate the database through c++ programs?
ReplyDeletePlease help....
sqlplus: command not found
ReplyDeleteI am getting this error !
Received this error after 1st command trying to convert rpm to deb file. Please help!
ReplyDeleteUnpacking of 'oracle-instantclient12.1-basic-12.1.0.1.0-1.i386.rpm' failed at /usr/share/perl5/Alien/Package/Rpm.pm line 168.
Worked no prob
ReplyDeleteI don't have initial USERNAME and PASSWORD! All attempts are giving errors. Please help as soon as posssible. I've tried with "SYS", "SYSTEM", "HR", . Nothing working.
ReplyDeleteim getting this error while connecting.. please help:::
ReplyDeletesachin@sachin-OptiPlex-745:~/Downloads$ sqlplus username/password@//dbhost:1521/SID
SQL*Plus: Release 12.1.0.1.0 Production on Thu Nov 14 10:26:48 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Enter user-name:
Hi,
ReplyDeleteHave done all the details steps as per the given instruction. Have added path /usr/lib/oracle/12.1/client64/lib in oracle.conf file.
Still getting the output sqlplus: command not found when trying sqlplus.
Request to help. thanks
Regards,
Biswajit
please help me solve these error in ubuntu
ReplyDeleteERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
please help with these ERROR:
ReplyDeleteORA-12545: Connect failed because target host or object does not exist
I am facing problm in installing 3 rpm packages....pls help me....facing problm package not found
ReplyDeleteGreat post !! thanks
ReplyDeleteHi,
ReplyDeleteWhen i try to login by typing sqlplus on terminal, it asks for username and password. What would be default username and password because while installing it didnt ask for these.
Thanks in advance.