Setting up Oracle InstantClient 10g for Windows or GNU/Linux
Prelude
I needed an Oracle client to connect to the Oracle server that I run on my home server and to connect to servers at work via the VPN, and, as I often dual-boot between Windows XP and Ubuntu Linux, I needed to install an Oracle client for both operating systems.
Oracle now provides a quick method for installing a client called Oracle InstantClient.
Oracle Client for Windows
Download the basic and sqlplus installs for Windows from here.
Create the folder c:\oracle
Unpack the files instantclient-basic-win32-10.1.0.3-20050113.zip
and instantclient-sqlplus-win32-10.1.0.3-20050113.zip
into c:\oracle
Right click "My Computer" -> Properties -> Advanced -> Environment Variables
Select the "Path" variable and click the "Edit" button and append ;c:\oracle
to the end of the existing line.
Setup a c:\oracle\tnsnames.ora
file similar to this example:
MYDB.WORLD= (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = IPAddress)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME= MYDB) ) )
Then connect to this database to test it as follows: sqlplus username/password@MYDB.WORLD
Oracle Client for Linux
Download the basic and sqlplus installs for Linux from here.
mkdir oracle mv instantclient-basic-linux-x86-64-10.1.0.3.zip oracle/ mv instantclient-sqlplus-linux-x86-64-10.1.0.3.zip oracle/ cd oracle unzip instantclient-basic-linux-x86-64-10.1.0.3.zip unzip instantclient-sqlplus-linux-x86-64-10.1.0.3.zip cd InstantClient10 mv * ../ rmdir InstantClient10 cat >> ~/.profile PATH=$PATH:/home/username/oracle SQLPATH=/home/username/oracle export SQLPATH LD_LIBRARY_PATH=/home/username/oracle export LD_LIBRARY_PATH TNS_ADMIN=/home/username/oracle export TNS_ADMIN
Setup a tnsnames.ora
file similar to this example:
cat > ~/oracle/tnsnames.ora MYDB.WORLD= (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = IPAddress)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME= MYDB) ) )
Then re-login to your user account, or restart your profile.
Then connect to this database to test it as follows: sqlplus username/password@MYDB.WORLD