DBA Hub

📋Steps in this guide1/7

Oracle Instant Client Installation

Quickly enable Oracle access without the need for a full-blown Oracle Client installation.

oracle miscconfigurationintermediate
by OracleDba
14 views
1

SQLcl

In many cases I now use SQLcl instead of the instant client. It's a small Java application from Oracle that gives you an SQL*Plus like experience, without needing a formal installation. Before considering the instant client, you should ask yourself if SQLcl would be more appropriate.
2

Yum

Since September 2018 the instant client RPMs have been freely available on yum.oracle.com . If you are using Oracle Linux and have root access you can install the instant client using Yum with a few simple commands. After this installation you can use SQL*Plus as follows. If you are running RHEL or another clone, you can download these RPMs from yum.oracle.com and install them locally.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# (Optional) Get the latest repository info.
cd /etc/yum.repos.d
rm -f public-yum-ol7.repo
wget https://yum.oracle.com/public-yum-ol7.repo

# Enable the instant client repository.
yum install -y yum-utils
yum-config-manager --enable ol7_oracle_instantclient

# (Optional) Check what packages are available.
yum list oracle-instantclient*

# Install basic and sqlplus.
yum install -y oracle-instantclient18.3-basic oracle-instantclient18.3-sqlplus

export CLIENT_HOME=/usr/lib/oracle/18.3/client64
export LD_LIBRARY_PATH=$CLIENT_HOME/lib
export PATH=$PATH:$CLIENT_HOME/bin

sqlplus /nolog
3

Manual Installation

The manual installation approach has two significant advantages over the Yum approach. - You don't need root access to install or update it. - You get to decide where the client is installed.
4

Download

The links below provide the general downloads page and the Linux x86-64 specific downloads, which will be used in this article. - Instant Client Downloads - Instant Client Downloads for Linux x86-64 There are a number of downloads available, depending on which features you require. The Linux versions also come with an RPM option, but as this requires root privilege to install, it may not be considered so desirable. The basic download provides all the core functionality necessary to make basic connections from Java. In this case, I wanted to make SQL*Plus connections, so I downloaded the following zip files. - instantclient-basic-linux.x64-11.2.0.4.0.zip - instantclient-sqlplus-linux.x64-11.2.0.4.0.zip
5

Installation

Installation couldn't really be simpler.

Code/Command (click line numbers to comment):

1
2
3
4
$ mkdir ~/software
$ cd ~/software
$ unzip /tmp/instantclient-basic-linux.x64-11.2.0.4.0.zip
$ unzip /tmp/instantclient-sqlplus-linux.x64-11.2.0.4.0.zip
6

Use It

When using the Instant Client, we need to make sure the environment variable is set to point to the location where the software was unzipped. In this case, I also set the environment variable. That's it!

Code/Command (click line numbers to comment):

1
2
3
4
$ export LD_LIBRARY_PATH=/home/tomcat/software/instantclient_11_2
$ export PATH=$PATH:$LD_LIBRARY_PATH

$ sqlplus scott/tiger@//myhost.example.com:1521/myservice
7

TNS_ADMIN

You can make connections to databases using the EZ Connect URL. If you would prefer to use a "tnsnames.ora" file, you can do that too. Just set the environment variable to the directory holding the file and it will work as expected. For example, imagine I had a "tnsnames.ora" file in my home directory with the following contents. I would do the following. For more information see: - Instant Client Downloads - Instant Client Downloads for Linux x86-64 - SQLcl : Installation Hope this helps. Regards Tim...

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
CONN scott/tiger@//myhost.example.com:1521/myservice

myservice= 
(DESCRIPTION = 
  (ADDRESS = (PROTOCOL = TCP)(HOST = myhost.example.com)(PORT = 1521))
  (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = myservice)
  )
)

export TNS_ADMIN=${HOME}

sqlplus scott/tiger@myservice

Comments (0)

Please to add comments

No comments yet. Be the first to comment!