Tuesday, July 21, 2009

Installing Oracle Instant Client 11 under LInux

Hi folks, in Talk about Linux today I'm going to show you how to Install Oracle Instant Client version 11.1.0.6.0, I really hope you'll be able to find this topic useful , this comment is focused above all to Install it in Slackware 12.2 but I'll try to describe in simple manner how to bring it to work in Fedora 11 and Ubuntu 9.04. Ok go ahead.

INSTALLING
First at all download all necessary files from oracle site relating to Instant Client, if you are interested in connect to the Database using jdbc or just type in sqlplus or you're planning to get to work Tora, you must be get all files: basic.zip, jdbc.zip, odbc.zip, sdk.zip, sqlplus.zip and tools.zip

Before you start the process I advise to you to work as root in a terminal, in case you're using Ubuntu just type: sudo -i to simulate initial login and it will work as su. So unzip every one using gzip or GUI Tool of your choice, all content should be inside the same folder ex. instantclient_11_1. Move the folder into /usr/lib ex. /usr/lib/instantclient_11_1 as root owner of course.

make a link of libclntsh.so.11.1 to libclntsh.so and libocci.so.11.1 to libocci.so inside Oracle Client directory as shown bellow
instantclient_11_1# ln -s libclntsh.so.11.1 libclntsh.so
instantclient_11_1# ln -s libocci.so.11.1 libocci.so

SETTING UP
Last part was so easy to do, now we're going to some tricks to setting up Client to getting to work
Slackware 12.2 edit /etc/profile file
Ubuntu 9.04 (Ubuntu as well) edit /etc/bash.bashrc and /etc/profile
put as you need next enviroment Variables:
export ORACLE_BASE="/usr/lib/instantclient_11_1"
export ORACLE_HOME="${ORACLE_BASE}"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ORACLE_BASE}"
export NLS_DATE_FORMAT="YYYYMMDD"
export NLS_LANG=SPANISH_AMERICA.WE8ISO8859P1
export TNS_ADMIN=/etc/oracle/
export SQLPATH="${ORACLE_BASE}"

As you see we difined TNS_ADMIN=/etc/oracle, it means we need to creat a directory under /etc called oracle, here we need to put our setting files sqlnet.ora and tnsnames.ora, it's so important you create both files if you want to get connected to an external Database
sqlnet.ora should contains this one
NAMES.DEFAULT_DOMAIN = your-domain

NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)

and tnsnames.ora should contains someting like that:
Database_Name.YOUR-DOMAIN =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = YOUR-HOST)(PORT = 1521))
)
(CONNECT_DATA =
(SID = DB-SID)
)
)

To have access to SQLPLUS from anywhere you must make a link tu /usr/bin
ln -s /lib/instantclient_11_1/sqlplus /usr/bin/sqlplus

In Ubuntu it's so common when you try to run sqlplus to get the next error:
sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory
Just you need to Set Up correctly LD_LIBRARY_PATH, please read the setting up block above.

TESTING
to test your Oracle Client connection you can use sqlplus, if its ask for password Oracle Client has been installed correctly, if you get some error please check step by step again.

$ sqlplus

SQL*Plus: Release 11.1.0.6.0 - Production on Mar Jul 21 18:22:27 2009

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

Introduzca el nombre de usuario:

I really hope this topic to be helpfully for you. See you soon

Enjoy the Life, Get the Slack! to the mack.

No comments: