Search This Blog

Total Pageviews

Monday, 4 April 2011

Install Oracle Instant Client for unix / Linux x86-64

Oracle Instant Client installation on unix 64 bit

Install Oracle thin client



Download following rpm from oracle website

oracle-instantclient11.2-basic-11.2.0.2.0.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.2.0.x86_64.rpm
oracle-instantclient11.2-sqlplus-11.2.0.2.0.x86_64.rpm


Instant Client Downloads site

http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html



apt-amd-02:/home/anujs/Downloads # rpm -ivh oracle-instantclient11.2-basic-11.2.0.2.0.x86_64.rpm
Preparing... ########################################### [100%]
1:oracle-instantclient11.########################################### [100%]


apt-amd-02:/usr # rpm -ql oracle-instantclient11.2-basic
/usr/lib/oracle/11.2/client64/bin/adrci
/usr/lib/oracle/11.2/client64/bin/genezi
/usr/lib/oracle/11.2/client64/lib/libclntsh.so.11.1
/usr/lib/oracle/11.2/client64/lib/libnnz11.so
/usr/lib/oracle/11.2/client64/lib/libocci.so.11.1
/usr/lib/oracle/11.2/client64/lib/libociei.so
/usr/lib/oracle/11.2/client64/lib/libocijdbc11.so
/usr/lib/oracle/11.2/client64/lib/ojdbc5.jar
/usr/lib/oracle/11.2/client64/lib/ojdbc6.jar
/usr/lib/oracle/11.2/client64/lib/xstreams.jar



apt-amd-02:/home/anujs/Downloads # rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.2.0.x86_64.rpm
Preparing... ########################################### [100%]
1:oracle-instantclient11.########################################### [100%]
apt-amd-02:/home/anujs/Downloads # rpm -ql oracle-instantclient11.2-sqlplus
/usr/bin/sqlplus64
/usr/lib/oracle/11.2/client64/bin/sqlplus
/usr/lib/oracle/11.2/client64/lib/glogin.sql
/usr/lib/oracle/11.2/client64/lib/libsqlplus.so
/usr/lib/oracle/11.2/client64/lib/libsqlplusic.so


when you install following rpm you will get following error ....

apt-amd-02:/home/anujs/Downloads # rpm -ivh oracle-instantclient-devel-10.2.0.4-1.x86_64.rpm
error: Failed dependencies:
oracle-instantclient-basic >= 10.2.0.4 is needed by oracle-instantclient-devel-10.2.0.4-1.x86_64




So use --nodeps for this rpm


apt-amd-02:/home/anujs/Downloads # rpm -ivh oracle-instantclient-devel-11.1.0.1-1.x86_64.rpm --nodeps
Preparing... ########################################### [100%]
1:oracle-instantclient-de########################################### [100%]



Create tnsnames.ora file in /etc


apt-amd-02:/usr/lib/oracle/11.2/client64/bin # cat /etc/tnsnames.ora
anujc =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.251)(PORT = 1521))
)
(CONNECT_DATA =
(sid = orcl)
)
)


set following variable or add into .bash_profile file

export TNS_ADMIN=/etc
export ORACLE_HOME=/usr/lib/oracle/11.2
export LD_LIBRARY_PATH=$ORACLE_HOME/client64/lib
PATH=$PATH:$HOME/bin:/sbin:$ORACLE_HOME/client64/bin


apt-amd-02:/usr/lib/oracle/11.2/client64/bin # pwd
/usr/lib/oracle/11.2/client64/bin


apt-amd-02:/usr/lib/oracle/11.2/client64/bin # sqlplus scott/tiger@anujc

SQL*Plus: Release 11.2.0.2.0 Production on Mon Apr 4 15:39:31 2011

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select * from tab;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
BONUS TABLE
DEPT TABLE
EMP TABLE
SALGRADE TABLE
T TABLE



Now connect to different database .


apt-amd-02:/usr/lib/oracle/11.2/client64/bin # sqlplus scott/tiger@anuj

SQL*Plus: Release 11.2.0.2.0 Production on Mon Apr 4 16:45:38 2011

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
apt-amd-02:/usr/lib/oracle/11.2/client64/bin # cat /etc/tnsnames.ora
anujc =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.251)(PORT = 1521))
)
(CONNECT_DATA =
(sid = orcl)
)
)


anuj =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.210)(PORT = 1521))
)
(CONNECT_DATA =
(SID = anujdb)
)
)

How to set CONNECT_DATA with SID in oracle for tnsnames.ora file

tnsnames.ora CONNECT_DATA SID



anuj2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.210)(PORT = 1521))
)
(CONNECT_DATA =
(SID = anujdb)
)
)



anuj3 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.210)(PORT = 1521))
)
(CONNECT_DATA =
(ORACLE_SID = anujdb)
)
)


oracle@novagenesis$ tnsping anuj2

TNS Ping Utility for Linux: Version 10.2.0.3.0 - Production on 04-APR-2011 11:31:19

Copyright (c) 1997, 2006, Oracle. All rights reserved.

Used parameter files:
/aptus/oracle/product/10g/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.210)(PORT = 1521))) (CONNECT_DATA = (SID = anujdb)))
OK (0 msec)


SQL> connect scott/tiger@anuj2
Connected.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

Oracle DBA

anuj blog Archive