Installing oracle instant client on Linux
This is a miniguide to install sqlplus with the minimal oracle-software fingerprint. As far as I can, I avoid to install the Oracle Client in my computers, because in MS Windows it modifies heavily the registry, and in linux you should set a lot of environment variables and deal with Oracle Universal Installer (OUI) that depends on many packages, versions, java … etc. And there is a better solution to install a simple sqlplus without installing the whole Oracle Client: oracle instant client.
I’ve used the 10.2.0.4 version, but I suppose that using any other 10.X or even 11.X version should be similar.
- Download instantclientXX files for your *NIX platform from oracle site. You only need the oracle-instantclient-basic and sqlplus packages, in Zip format (about 35Mb total). Move them to tmp and unzip.
- Create the following directory structure and spread the files over as:
| |– genezi
| |– glogin.sql
| |– sqlnet.log
| `– sqlplus
| |– BASIC_README
| `– SQLPLUS_README
- Create the subdirectory network and create a tnsnames.ora sample file
root@core:/opt/oracle# mkdir network
root@core:/opt/oracle# cat tnsnames.ora
(ADDRESS = (PROTOCOL = TCP) (HOST = my.oracle.server.org)(PORT = 1521))
(CONNECT_DATA = (SID = ORCL))
- Add the SO files path to the ld.so.conf. In debian-based *NIXes that consist in creating a file under /etc/ld.so.conf.d/ that contains the new path for SO files. In redhat-based *NIXes you should add the /opt/oracle/lib to the contents of /etc/ld.so.conf file.
root@core:/opt/oracle# vi /etc/ld.so.conf.d/oracle.conf
- Run ldconfig tocreate the necessary links and cache for use by the runtime linker.
- Finally, add /opt/oracle/bin to the user’s PATH, and declare TNS_ADMIN envvar pointing to the location of tnsnames.ora file, like:
root@core:/opt/oracle# export TNS_ADMIN=/opt/oracle/network
Or add the following line to the /etc/profile
In order to allow each user to create its own tnsnames.ora file under his home.
- And enjoy:
root@core:/opt/oracle/bin# sqlplus /nolog
SQL*Plus: Release 10.2.0.4.0 - Production on Sun Jul 19 12:31:00 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
SQL> conn system/manager@XE