Some time ago Oracle introduced their Instant Client as an alternative to needing a full install of the Oracle client to run your own apps or SQLPlus. I've been putting the Instant Client to good use these days and figured I would give a quick howto on getting it set up.
First you should download the correct binary for what you want to do. They have a build for a lot of different platforms and then they also split the libraries themselves out from SQLPlus. If all you need is the OCI library then all you have to do is download that part. I find it nice to get both the libraries and SQLPlus so I can verify that the setup works.
After you have downloaded that client you will need to unzip it. In the current case the directory it creates is "instantclient_10_2" and in this example I'm going to assume you got both the libraries and SQLPlus. After unziping both packages change into the instantclient_10_2 directory.
Now that you are in the instantclient_10_2 directory you will need to set up some environment variables to be able to run SQLPlus. The following will do the trick (just remember that I'm assuming that everything you need is in your current directory, you would of course need to change these if you want to install in a different location):
export LD_LIBRARY_PATH=. export TNS_ADMIN=. export ORACLE_HOME=.
Now you will need to create of copy a tnsnames.ora file into your current directory. Here is an example assuming you have Oracle running on a box at 192.168.1.100 with a listener on port 1521 and a SID of XE:
XE.WORLD = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = tcp.world) (PROTOCOL = TCP) (Host = 192.168.1.100) (Port = 1521) ) ) (CONNECT_DATA = (SID = XE) ) )
Now you are ready to go. Just run the following to connect to your Oracle database:
Oracle's Instant Client makes the world much easier now. In just a few steps you are able to connect to an Oracle database with SQLPlus and don't have to go through a ton of installation mess.
As a side note, I also found that if you grab the header files from a full installation you can easily compile against the Instant Client libraries when using OCI calls. This can make developing an application that connects to Oracle very easy to set up.
Tags: oracle, sqlplus, instant client