First start with unixodbc installation
$sudo apt-get install unixodbc
To conform the installation just type in isql from the shell and should work.
Install the alien utility (You need to install local .rpm packages)
$sudo apt-get install alien
Install libaio1 64 bit$sudo apt-get install libaio1
I have followed the steps from this post. But simplified it little bit.
https://help.ubuntu.com/community/Oracle%20Instant%20Client
You need to first download them from Oracle site.
Instant Client Home page:http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
Download page: http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html (Linux 64 bit)
I went with the following packages
Instant Client Package - Basic Instant Client Package - JDBC Supplement Instant Client Package - SQL*Plus Instant Client Package - ODBC |
Next install the rpm's using the alien utility.
sudo alien -i oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
Install the other rpms in the same way
Setup the Oracle environment variables globally. You can do it in your user .profile as well.
Create a file "sudo vi /etc/profile.d/oracle.sh" with the following content.
export ORACLE_HOME=/usr/lib/oracle/12.1/client64
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
logoff and login back and try sqlplus
user@ubuntu:~$ which sqlplus
/usr/lib/oracle/12.1/client64/bin/sqlplus
user@ubuntu:~$ sqlplus
SQL*Plus: Release 12.1.0.2.0 Production on Wed Jan 18 12:14:14 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Enter user-name:
If you get the above response, you are almost done. At this stage you can connect to your Oracle database using EZConnect string
$ sqlplus scott/tiger@myoracledb.example.com:1521/ORCL
SQL*Plus: Release 12.1.0.2.0 Production on Wed Jan 18 12:17:00 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Last Successful login time: Wed Jan 18 2017 02:22:27 -05:00
Connected to:
Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
SQL>
Just finish it up by setting up sqlnet.ora and tnsnames.ora
Create /network/admin directory under $ORACLE_HOME (/usr/lib/oracle/12.1/client64) folder
Under the same create sqlnet.ora. Sample below
names.directory_path = (EZCONNECT, LDAP, TNSNAMES, HOSTNAME)
Create tnsnames.ora Sample content below
MY_ORACLE_DB= (description= (address_list= (address = (protocol = TCP)(host = myoracledb.example.com)(port = 1521)) ) (connect_data = (service_name=ORCL) ))
Now you can connect using $sqlplus scott/tiger@MY_ORACLE_DB
You are done and enjoy.