Oracle Instant Client installation on Linux

From time to time, you may need to access Oracle database from a remote server which doesn’t have Oracle client installed. Using Oracle Instant Client is a lightweight, easy-to-implement solution. The current version is 19.8.0.0.0. In this post, I am demonstrating the installation of an older version – 12.1 on Linux 6.3 64-bit. The reason to choose an older version was because the latest or newer versions might have some requirements of dependent libraries. Although using yum can greatly solve the depency issues, there might just no newer libraries for an old OS kernel unless you update the kernel first which is against the inital goal to install a lightweight client.

To start, first download the Instant Client packages (I use RPM package, but it’s the same for ZIP packages) from the URL. You need a basic or basic light package. In the demo, I also downloaded the additonal package for SQL*Plus.

  1. Install the basic RPM package using yum. It will install depency package as well. In this example, it installed libaio from the public YUM repository. If using the ZIP package, you will need to install libaio seperately.
[root@joetest01 ~]# yum install oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
Setting up Install Process
Examining oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm: oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64
Marking oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-instantclient12.1-basic.x86_64 0:12.1.0.2.0-1 will be installed
--> Processing Dependency: libaio for package: oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64
--> Running transaction check
---> Package libaio.x86_64 0:0.3.107-10.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================================
 Package                                            Arch                       Version                            Repository                                                               Size
================================================================================================================================================================================================
Installing:
 oracle-instantclient12.1-basic                     x86_64                     12.1.0.2.0-1                       /oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64                     185 M
Installing for dependencies:
 libaio                                             x86_64                     0.3.107-10.el6                     ol6_latest                                                               21 k

Transaction Summary
================================================================================================================================================================================================
Install       2 Package(s)

Total size: 185 M
Total download size: 21 k
Installed size: 185 M
Is this ok [y/N]: y
Downloading Packages:
libaio-0.3.107-10.el6.x86_64.rpm                                                                                                                                         |  21 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libaio-0.3.107-10.el6.x86_64                                                                                                                                                 1/2
  Installing : oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64                                                                                                                           2/2
  Verifying  : libaio-0.3.107-10.el6.x86_64                                                                                                                                                 1/2
  Verifying  : oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64                                                                                                                           2/2

Installed:
  oracle-instantclient12.1-basic.x86_64 0:12.1.0.2.0-1

Dependency Installed:
  libaio.x86_64 0:0.3.107-10.el6

Complete!

2. Create runtime link path. The Instant Client is installed under “/usr/lib/oracle/<version>/client64/

[root@joetest01 ~]# echo /usr/lib/oracle/12.1/client64/lib > /etc/ld.so.conf.d/oracle-instantclient.conf
[root@joetest01 ~]# cat /etc/ld.so.conf.d/oracle-instantclient.conf
/usr/lib/oracle/12.1/client64/lib
[root@joetest01 ~]# ldconfig

3. Install SQL*Plus package using yum

[root@joetest01 ~]# yum install oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
Setting up Install Process
Examining oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm: oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64
Marking oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-instantclient12.1-sqlplus.x86_64 0:12.1.0.2.0-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================================
 Package                                             Arch                      Version                           Repository                                                                Size
================================================================================================================================================================================================
Installing:
 oracle-instantclient12.1-sqlplus                    x86_64                    12.1.0.2.0-1                      /oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64                    3.0 M

Transaction Summary
================================================================================================================================================================================================
Install       1 Package(s)

Total size: 3.0 M
Installed size: 3.0 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64                                                                                                                         1/1
  Verifying  : oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64                                                                                                                         1/1

Installed:
  oracle-instantclient12.1-sqlplus.x86_64 0:12.1.0.2.0-1

Complete!

4. Modify the shell profile for the user who intends to use the Instant Client. For example, for BASH, modify “~/.bash_profile” to add variables for the Instant Client path and library.

LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

PATH=/usr/lib/oracle/12.1/client64/bin/:$PATH
export PATH

5. Add the connection configuration into tnsnames.ora, sqlnet.ora etc under the default directory (need to create it first) or define the environment varialbe TNS_ADMIN if using another directory.

[root@joetest01 ~]# mkdir -p /usr/lib/oracle/12.1/client64/lib/network/admin

Now you are good to go!

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s