oracledba.help
Install

Oracle 23 Instant Client Setup for Linux 9.x

Overview

What follows is the most common way to install the Oracle 23 Instant Client on Linux 9.x. RHEL 9.7 used for these docs. Also tested on Alma 9.7.

Prerequisites

Update OS Patches and Packages

 dnf clean all
 dnf check-update
 dnf update -y
 cat /etc/redhat-release 

Configure Repo

Redhat 9.x

tee /etc/yum.repos.d/oracle-instantclient.repo >/dev/null <<'EOF'
[ol9_oracle_instantclient23]
name=Oracle Instant Client 23 for OL9 (usable on RHEL/Alma)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL9/oracle/instantclient23/x86_64/
enabled=1
gpgcheck=1
gpgkey=https://yum.oracle.com/RPM-GPG-KEY-oracle-ol9
EOF

Refresh Metadata

 dnf clean all
 dnf makecache

Alma

tee /etc/yum.repos.d/oracle-instantclient.repo >/dev/null <<'EOF'
[ol9_oracle_instantclient23]
name=Oracle Instant Client 23 for OL9 (usable on RHEL/Alma)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL9/oracle/instantclient23/x86_64/
enabled=1
gpgcheck=1
gpgkey=https://yum.oracle.com/RPM-GPG-KEY-oracle-ol9
EOF

Refresh Metadata

 dnf clean all
 dnf makecache

Installation

1. Client Installaion

 1.1 Redhat 9.x
  dnf install -y oracle-instantclient-release-el9
  dnf config-manager --enable ol9_oracle_instantclient

  -- Verify repo:
  dnf repolist | grep oracle


 1.2 Alma
  dnf repolist
  dnf list oracle-instantclient\*

  23
  dnf install -y oracle-instantclient-basic oracle-instantclient-sqlplus

  19
  dnf install -y oracle-instantclient19.29-basic oracle-instantclient19.29-sqlplus%


 1.5 Install Supplementary Tools

  -- Alma
  dnf install -y oracle-instantclient-tools
  dnf install -y oracle-instantclient-devel
  dnf install -y oracle-instantclient-jdbc
  dnf install -y oracle-instantclient-odbc
  dnf list oracle-instantclient\*

  -- Redhat
  dnf install -y oracle-instantclient-devel oracle-instantclient-jdbc oracle-instantclient-odbc
  dnf list oracle-instantclient\*

2. Verify

dnf list installed | grep oracle-instantclient

Example Output:
oracle-instantclient-basic.x86_64                23.26.0.0.0-1.el9...
oracle-instantclient-devel.x86_64                23.26.0.0.0-1.el9...
oracle-instantclient-jdbc.x86_64                 23.26.0.0.0-1.el9...
oracle-instantclient-odbc.x86_64                 23.26.0.0.0-1.el9...
oracle-instantclient-sqlplus.x86_64              23.26.0.0.0-1.el9...
oracle-instantclient-tools.x86_64                23.26.0.0.0-1.el9...

3. Configure Environment

# Oracle 23 Instant Client
export LD_LIBRARY_PATH=/usr/lib/oracle/23/client64/lib:$LD_LIBRARY_PATH
export PATH=/usr/lib/oracle/23/client64/bin:$PATH
export TNS_ADMIN=/u01/app/oracle/network/admin

# For login.sql
export SQLPATH=/usr/lib/oracle/23/client64/sqlplus/admin
export ORACLE_PATH=/usr/lib/oracle/23/client64/sqlplus/admin

QC

 source .bashrc
 clear;printenv|grep LD_LIB;printenv|grep TNS_ADMIN

4. Create TNS Alias

mkdir -p /u01/app/oracle/network/admin
chmod -R 777 /u01/app/oracle/network/admin
su - oracle
vi /u01/app/oracle/network/admin/tnsnames.ora

Example Entry:

SVCNAME =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = your-db-host)(PORT = 1521))
    (CONNECT_DATA =
      (SERVICE_NAME = your-db-service)
    )
  )

5. Using SQL*Plus

 -- Simple tnsping Equiv
 sqlplus -L /@ALIAS

 -- OK Looks Like This
 ORA-01017: invalid username/password; logon denied

 -- Cannot Connect Looks Like This
 ORA-12154: Cannot connect to database. Cannot find alias ... in /u01/app/oracle/network/admin/tnsnames.ora.


 -- Login Test
 sqlplus username/password@TNS_ALIAS
 sqlplus osibank/********@DNATEST.WORLD

Post Install Tasks

Enable login.sql

   -- Create a Custom Directory for SQL*Plus Admin
   mkdir -p /usr/lib/oracle/23/client64/sqlplus/admin
   chmod -R 777 /usr/lib/oracle/23/client64/sqlplus/admin

   -- Create the login.sql File
   vi /usr/lib/oracle/23/client64/sqlplus/admin/login.sql
   SET LINESIZE 240
   SET PAGESIZE 9999
   SET SQLPROMPT "_USER'@'_CONNECT_IDENTIFIER> " 

   -- Test
   sqlplus /nolog

Note glogin.sql does not work with this version.

Create Linux oracle User

The oracle user is not required to use instant client. Many still prefer to create one on each system for testing and support.

-- Init repo

tee /etc/yum.repos.d/oracle-db.repo >/dev/null <<'EOF'
[ol9_oracle_db]
name=Oracle Database Preinstall for OL9 (usable on RHEL/Alma)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL9/appstream/x86_64/
enabled=1
gpgcheck=1
gpgkey=https://yum.oracle.com/RPM-GPG-KEY-oracle-ol9
EOF

-- Install

-- dnf
   dnf clean all
   dnf makecache
   dnf install -y oracle-database-preinstall-23ai

-- QC
   rpm -qi oracle-database-preinstall-23ai

-- Set Password
   passwd oracle

Troubleshooting

Common Cmds

  sqlplus -v
  ldd $(which sqlplus)
  echo $TNS_ADMIN

Disable Firewall

  systemctl disable firewalld --now
  systemctl status firewalld

Missing libraries?

  ldd /usr/lib/oracle/23/client64/bin/sqlplus