Sunday, July 14, 2013

How to install Oracle Instant Client 12c and Oracle SQL Plus on Ubuntu

So you want to use your Ubuntu distribution and connect to an Oracle database.
Here you can find the steps to install and configure the Oracle Instant Client on Ubuntu 12.04.

First of all you need to go to the following link and choose the Instant Client for your platform (in my case it is "Instant Client for Linux x86").

On the next web page select "Accept License Agreement" so you can download some rpm packets of the latest available Instant Client version (today is Version

Click on oracle-instantclient12.1-basic- (Instant Client Package - Basic: All files required to run OCI, OCCI, and JDBC-OCI applications), oracle-instantclient12.1-sqlplus- (Instant Client Package - SQL*Plus: Additional libraries and executable for running SQL*Plus with Instant Client) and oracle-instantclient12.1-devel- (Instant Client Package - SDK: Additional header files and an example makefile for developing Oracle applications with Instant Client).

To be available to download those rpm packets you have also to sign in into the Oracle website.

Next step is to install alien on your distribution.
From the man page "alien is a program that converts between Red Hat rpm, Debian deb, Stampede slp, Slackware tgz, and Solaris pkg file formats. If you want to use a package from another linux distribution than the one you have installed on your system, you can use alien to convert it to your preferred package format and install it."

ubuntu@ubuntu-VirtualBox:~$ sudo apt-get install alien
Then go to your download directory and list the available rpm packets.
ubuntu@ubuntu-VirtualBox:~$ cd Downloads/
ubuntu@ubuntu-VirtualBox:~/Downloads$ ls
Let's install all of them using alien command:
ubuntu@ubuntu-VirtualBox:~/Downloads$ sudo alien -i oracle-instantclient12.1-sqlplus-
    dpkg --no-force-overwrite -i oracle-instantclient12.1-sqlplus_12.
Selecting previously unselected package oracle-instantclient12.1-sqlplus.
(Reading database ... 142987 files and directories currently installed.)
Unpacking oracle-instantclient12.1-sqlplus (from oracle-instantclient12.1-sqlplus_12. ...
Setting up oracle-instantclient12.1-sqlplus ( ...
Now it's time for the Instant Client Basic Package:
ubuntu@ubuntu-VirtualBox:~/Downloads$ sudo alien -i oracle-instantclient12.1-basic-
    dpkg --no-force-overwrite -i oracle-instantclient12.1-basic_12.
Selecting previously unselected package oracle-instantclient12.1-basic.
(Reading database ... 143000 files and directories currently installed.)
Unpacking oracle-instantclient12.1-basic (from oracle-instantclient12.1-basic_12. ...
Setting up oracle-instantclient12.1-basic ( ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
And finally it's time for Instant Client SDK Package:
ubuntu@ubuntu-VirtualBox:~/Downloads$ sudo alien -i oracle-instantclient12.1-devel-
    dpkg --no-force-overwrite -i oracle-instantclient12.1-devel_12.
Selecting previously unselected package oracle-instantclient12.1-devel.
(Reading database ... 143016 files and directories currently installed.)
Unpacking oracle-instantclient12.1-devel (from oracle-instantclient12.1-devel_12. ...
Setting up oracle-instantclient12.1-devel ( ...
Let's try to issue the sqlplus command
ubuntu@ubuntu-VirtualBox:~$ sqlplus / as sysdba
sqlplus: error while loading shared libraries: cannot open shared object file: No such file or directory
Ops.. it fails because of a missing shared object file: So install libaio1 using the usual apt-get command.
ubuntu@ubuntu-VirtualBox:~$ sudo apt-get install libaio1
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 608 not upgraded.
Need to get 6,648 B of archives.
After this operation, 53.2 kB of additional disk space will be used.
Get:1 precise/main libaio1 i386 0.3.109-2ubuntu1 [6,648 B]
Fetched 6,648 B in 0s (12.5 kB/s)
Selecting previously unselected package libaio1.
(Reading database ... 143067 files and directories currently installed.)
Unpacking libaio1 (from .../libaio1_0.3.109-2ubuntu1_i386.deb) ...
Setting up libaio1 (0.3.109-2ubuntu1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Let's try to run sqlplus again.
ubuntu@ubuntu-VirtualBox:~/Downloads$ sqlplus / as sysdba
sqlplus: error while loading shared libraries: cannot open shared object file: No such file or directory
sqlplus complains about missing libraries. You can solve creating/editing the oracle.conf file issuing the following command and simply adding a line (the path where were installed all the libraries of the Instant Client packages: /usr/lib/oracle/12.1/client/lib):
ubuntu@ubuntu-VirtualBox:~/Downloads$sudo vi /etc/
Now update the information of all the shared libraries on your system.
ubuntu@ubuntu-VirtualBox:~/Downloads$sudo ldconfig
Run sqlplus again... and as you can see it works...
ubuntu@ubuntu-VirtualBox:~$ sqlplus / as sysdba

SQL*Plus: Release Production on Sun Jul 14 20:01:37 2013

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

ORA-12162: TNS:net service name is incorrectly specified
... even if there's no database to connect to...
On the next post a new Oracle Database 12c will be finally available.

That's all.


Anonymous said...

Excelent work!!

Ashrith H Chinivar said...

I did exactly the same but at the end, it asks for username and password. Since no password is given during installation, WHAT is my username and password? Can I reset password using commandline? HELP please!

arok jaise said...

what is the default user name and password pleaseee

Avinash pal said...

please help me default username & password is not working for me its urgent
help me

oakleyses said...

oakley sunglasses, prada handbags, oakley sunglasses, longchamp handbags, longchamp handbags, louboutin shoes, louis vuitton handbags, coach factory outlet, tiffany and co, coach purses, louis vuitton outlet, polo ralph lauren outlet, air max, prada outlet, longchamp outlet, oakley sunglasses cheap, ray ban sunglasses, louboutin outlet, michael kors outlet, michael kors outlet, tiffany and co, burberry outlet, christian louboutin shoes, coach outlet store online, jordan shoes, polo ralph lauren outlet, louboutin, kate spade handbags, michael kors outlet, coach outlet, air max, gucci outlet, michael kors outlet, ray ban sunglasses, chanel handbags, michael kors outlet, tory burch outlet, nike free, kate spade outlet, louis vuitton outlet, burberry outlet, louis vuitton outlet stores, louis vuitton, nike shoes, michael kors outlet

oakleyses said...

air max, hollister, true religion outlet, nike blazer, louboutin, ray ban sunglasses, polo ralph lauren, michael kors, true religion jeans, sac guess, sac longchamp, hogan outlet, ralph lauren, vans pas cher, sac louis vuitton, air max pas cher, nike free pas cher, nike free, air max, mulberry, nike roshe run, sac burberry, hollister, vanessa bruno, louis vuitton, lululemon, michael kors pas cher, oakley pas cher, air jordan, ray ban pas cher, new balance pas cher, polo lacoste, converse pas cher, north face, sac louis vuitton, michael kors, sac hermes, nike tn, timberland, louis vuitton uk, longchamp, true religion jeans, nike air max, air force, north face

oakleyses said...

abercrombie and fitch, instyler, ghd, bottega veneta, ugg boots, jimmy choo outlet, soccer shoes, ugg pas cher, herve leger, beats by dre, birkin bag, abercrombie and fitch, north face jackets, soccer jerseys, mont blanc, rolex watches, lululemon outlet, celine handbags, nike roshe run, nike trainers, giuseppe zanotti, hollister, wedding dresses, nike huarache, mcm handbags, vans shoes, chi flat iron, babyliss pro, north face outlet, nike roshe, ugg australia, ugg, marc jacobs, barbour, nfl jerseys, p90x, new balance shoes, asics running shoes, ferragamo shoes, mac cosmetics, insanity workout, uggs outlet, reebok outlet, longchamp, valentino shoes

oakleyses said...

converse, air max, gucci, canada goose, juicy couture outlet, canada goose, wedding dresses, moncler, ralph lauren, lancel, montre homme, moncler, louboutin, oakley, karen millen, vans, coach outlet store online, air max, canada goose jackets, ugg, hollister clothing store, louis vuitton, baseball bats, hollister, rolex watches, juicy couture outlet, iphone 6 cases, canada goose uk, canada goose outlet, ugg, moncler, moncler outlet, timberland boots, hollister, supra shoes, moncler, canada goose, converse shoes, toms shoes, moncler, moncler, canada goose, ugg boots, ray ban, parajumpers, canada goose