SQL*Plus on Debian

In this article, I will describe the steps necessary to install Oracle SQL*Plus on a Debian host. I am using Debian 6.0.5 and will install the “Instant Client” package from Oracle (version 11.2.0.3). First, we will prepare the system for the installation, download the installation package, set all the necessary variables, start SQL*Plus and connect to an instance. So let’s get started…

Before we begin the package installation, we need to make sure the necessary prerequisite packages are installed. Oracle Instant Client requires the libaio package, so let’s install that:

# aptitude install libaio1

Next, we need to prepare the environment. I am going to install the package to /opt/oracle, generally you may place it anywhere you like. Then, assign the correct permissions to the folder, if you plan to install the package as a different user than root:

# mkdir -p /opt/oracle
# chown simon:simon /opt/oracle

Now change to your ordinary user (“simon” in my case) and change to the newly created folder:

$ cd /opt/oracle

Visit the Oracle homepage for Instant Client and download the following two packages. Please note that you might need to download the x86 version or the x64 version, depending on your operating system.

  • instantclient-basic-linux.x64-11.2.0.3.0.zip
  • instantclient-sqlplus-linux.x64-11.2.0.3.0.zip

Transfer the archives to your Debian host and unpack them in /opt/oracle:

$ unzip instantclient-basic-linux.x64-11.2.0.3.0.zip
$ unzip instantclient-sqlplus-linux.x64-11.2.0.3.0.zip

Alright, we’re basically done. The installation is now more or less complete. To run SQL*Plus, define the LD_LIBRARY_PATH environment variable and set it to the folder where you unpacked the Instant Client packages:

$ export LD_LIBRARY_PATH=/opt/oracle/instantclient_11_2/

You should also add this line to your ~/.bashrc, so it always gets set when you log in. Note that when using scripts, you might need to add this line to your script, otherwise SQL*Plus will complain!

From here on everything works as you know it. Set ORACLE_SID and launch SQL*Plus:

$ export ORACLE_SID=skint02
$ ./sqlplus /nolog

SQL*Plus: Release 11.2.0.3.0 Production on Wed Sep 5 09:45:36 2012

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

SQL> connect sys/super_secret@prometheus.krenger.local/skint02 as sysdba
Connected.
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE    10.2.0.5.0      Production
TNS for 64-bit Windows: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
$

Hello world

My name is Simon Krenger, I am a Technical Account Manager (TAM) at Red Hat. I advise our customers in using Kubernetes, Containers, Linux and Open Source.

Elsewhere

  1. GitHub
  2. LinkedIn
  3. GitLab