Suppose that you have known the differences between Oracle client and Oracle instant client, and decide to install Oracle instant client for your machine.
On Windows, Oracle Instant Client is easy to be installed, you can just unzip it, setup required environment variable and make it useful in a minute. But on Linux, it could be a little tricky to have it.
Let's see the steps to install Oracle Instant Client on Linux.
Unzip Oracle Instant Client Packages
We have downloaded packages of Oracle instant client and uploaded 2 of them to the user's home directory.
- Basic Package (instantclient-basic-linux.x64-19.18.0.0.0dbru.zip)
- SQL*Plus Package (instantclient-sqlplus-linux.x64-19.18.0.0.0dbru.zip)
[erp@test ~]$ ll
total 74108
-rwxrwxr-x 1 erp erp 74970549 Jan 31 01:33 instantclient-basic-linux.x64-19.18.0.0.0dbru.zip
-rwxrwxr-x 1 erp erp 911674 Jan 31 01:34 instantclient-sqlplus-linux.x64-19.18.0.0.0dbru.zip
drwxrwxr-x 2 erp erp 6 Jan 31 01:31 oracle-instant-client
Then we unzipped them to the same destination.
[erp@test ~]$ unzip -q instantclient-basic-linux.x64-19.18.0.0.0dbru.zip -d ./oracle-instant-client
[erp@test ~]$ unzip -q instantclient-sqlplus-linux.x64-19.18.0.0.0dbru.zip -d ./oracle-instant-client
Let's see its content.
[erp@test ~]$ ll ./oracle-instant-client
total 4
drwxrwxr-x 3 erp erp 4096 Jan 31 01:35 instantclient_19_18
[erp@test ~]$ ll ./oracle-instant-client/instantclient_19_18
total 236676
-rwxr-xr-x 1 erp erp 42000 Jan 11 13:28 adrci
-r-xr-xr-x 1 erp erp 5780 Jan 11 13:28 BASIC_LICENSE
-rw-r--r-- 1 erp erp 1633 Jan 11 13:28 BASIC_README
-rwxr-xr-x 1 erp erp 59360 Jan 11 13:28 genezi
-rw-r--r-- 1 erp erp 342 Jan 11 13:29 glogin.sql
-rwxr-xr-x 1 erp erp 8057680 Jan 11 13:28 libclntshcore.so.19.1
lrwxrwxrwx 1 erp erp 17 Jan 31 01:35 libclntsh.so -> libclntsh.so.19.1
lrwxrwxrwx 1 erp erp 17 Jan 31 01:35 libclntsh.so.10.1 -> libclntsh.so.19.1
lrwxrwxrwx 1 erp erp 17 Jan 31 01:35 libclntsh.so.11.1 -> libclntsh.so.19.1
lrwxrwxrwx 1 erp erp 17 Jan 31 01:35 libclntsh.so.12.1 -> libclntsh.so.19.1
lrwxrwxrwx 1 erp erp 17 Jan 31 01:35 libclntsh.so.18.1 -> libclntsh.so.19.1
-rwxr-xr-x 1 erp erp 81268192 Jan 11 13:28 libclntsh.so.19.1
-r-xr-xr-x 1 erp erp 3659640 Jan 11 13:28 libipc1.so
-r-xr-xr-x 1 erp erp 478768 Jan 11 13:28 libmql1.so
-rwxr-xr-x 1 erp erp 5844160 Jan 11 13:28 libnnz19.so
lrwxrwxrwx 1 erp erp 15 Jan 31 01:35 libocci.so -> libocci.so.19.1
lrwxrwxrwx 1 erp erp 15 Jan 31 01:35 libocci.so.10.1 -> libocci.so.19.1
lrwxrwxrwx 1 erp erp 15 Jan 31 01:35 libocci.so.11.1 -> libocci.so.19.1
lrwxrwxrwx 1 erp erp 15 Jan 31 01:35 libocci.so.12.1 -> libocci.so.19.1
lrwxrwxrwx 1 erp erp 15 Jan 31 01:35 libocci.so.18.1 -> libocci.so.19.1
-rwxr-xr-x 1 erp erp 2342024 Jan 11 13:28 libocci.so.19.1
-rwxr-xr-x 1 erp erp 130556368 Jan 11 13:28 libociei.so
-r-xr-xr-x 1 erp erp 153464 Jan 11 13:28 libocijdbc19.so
-rwxr-xr-x 1 erp erp 116376 Jan 11 13:28 liboramysql19.so
-rwxr-xr-x 1 erp erp 1660784 Jan 11 13:29 libsqlplusic.so
-rwxr-xr-x 1 erp erp 1577472 Jan 11 13:29 libsqlplus.so
drwxr-xr-x 3 erp erp 19 Jan 11 13:28 network
-rw-r--r-- 1 erp erp 4485665 Jan 11 13:28 ojdbc8.jar
-rwxr-xr-x 1 erp erp 24808 Jan 11 13:29 sqlplus
-r-xr-xr-x 1 erp erp 5780 Jan 11 13:29 SQLPLUS_LICENSE
-rw-r--r-- 1 erp erp 1641 Jan 11 13:29 SQLPLUS_README
-rw-r--r-- 1 erp erp 1689968 Jan 11 13:28 ucp.jar
-rwxr-xr-x 1 erp erp 237848 Jan 11 13:28 uidrvci
-rw-r--r-- 1 erp erp 31825 Jan 11 13:28 xstreams.jar
Set Environment Variables
We add following environment variables in our profile.
- ORACLE_HOME (optional)
- LD_LIBRARY_PATH
- PATH
- NLS_LANG (optional)
[erp@test ~]$ vi .bash_profile
...
ORACLE_HOME=/home/erp/oracle-instant-client/instantclient_19_18
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME
PATH=$PATH:$ORACLE_HOME
NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_HOME LD_LIBRARY_PATH PATH NLS_LANG
We take them effect by sourcing .bash_profile.
[erp@test ~]$ . ~/.bash_profile
Are they setup correctly?
[erp@test ~]$ echo $ORACLE_HOME
/home/erp/oracle-instant-client/instantclient_19_18
[erp@test ~]$ echo $LD_LIBRARY_PATH
:/home/erp/oracle-instant-client/instantclient_19_18
Good!
Edit tnsnames.ora
We edit an entry (connect identifier) in tnsnames.ora.
[erp@test ~]$ vi $ORACLE_HOME/network/admin/tnsnames.ora
...
ORCLPDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.10)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCLPDB)
(SERVER = DEDICATED)
)
)
There're more about tnsnames.ora, you may have a look.
Connection Test
We have SQL*Plus and tnsnames.ora, we can make a connection by SQL*Plus.
[erp@test ~]$ sqlplus /nolog
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jan 31 01:48:25 2023
Version 19.18.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
SQL> conn hr/hr@orclpdb
Connected.
Done!
Now the Oracle instant client in the machine has the ability to connect to external databases.