install oracle instant client on mac os x lion

I recently installed Oracle 11gR2 on a fresh CentOS server. Since I usually work on my Mac, I wanted Sql*Plus on it. I already have Sqldeveloper, but there is really no substitute for CLI when it comes to Oracle.

Beware that the 64-bit binaries does not work on Lion – you will get a ‘error 11′ when you try to execute sqlplus. Download the 32-bit binaries!

Download the files from Oracle

The files I downloaded are:

http://download.oracle.com/otn/mac/instantclient/10204/instantclient-basic-10.2.0.4.0-macosx-x86.zip

http://download.oracle.com/otn/mac/instantclient/10204/instantclient-sqlplus-10.2.0.4.0-macosx-x86.zip

Unzip and copy/move

Move/copy the files somewhere – put all in the same directory. I put them in /Applications/instantclient_10_2. Create a directory to hold the tnsnames.ora file. I created /Applications/instantclient_10_2/network/admin.

macpro:instantclient_10_2 janhellevik$ pwd
/Applications/instantclient_10_2
macpro:instantclient_10_2 janhellevik$ ls -la
total 200848
drwxr-xr-x@ 20 janhellevik  staff       680 Sep  5 15:39 .
drwxrwxr-x+ 62 root         admin      2108 Sep  5 15:17 ..
-rw-r--r--@  1 janhellevik  staff      6148 Sep  5 15:36 .DS_Store
-rw-r--r--@  1 janhellevik  staff       278 Apr  1  2009 BASIC_README
-rw-r--r--@  1 janhellevik  staff       282 Apr  1  2009 SQLPLUS_README
-r--r--r--@  1 janhellevik  staff   1609607 Feb  2  2008 classes12.jar
-rwxr-xr-x@  1 janhellevik  staff     30556 Apr  1  2009 genezi
-r-xr-xr-x@  1 janhellevik  staff      1525 Aug 30  2004 glogin.sql
-rwxr-xr-x@  1 janhellevik  staff  21537536 Mar 31  2009 libclntsh.dylib.10.1
-rwxr-xr-x@  1 janhellevik  staff   1683924 Feb 11  2009 libnnz10.dylib
-rwxr-xr-x@  1 janhellevik  staff   1142284 Feb 11  2009 libocci.dylib.10.1
-rwxr-xr-x@  1 janhellevik  staff  72626824 Apr  1  2009 libociei.dylib
-rwxr-xr-x@  1 janhellevik  staff    106184 Mar 25  2009 libocijdbc10.dylib
-rwxr-xr-x@  1 janhellevik  staff    106184 Mar 25  2009 libocijdbc10.jnilib
-rwxr-xr-x@  1 janhellevik  staff    933744 Mar 25  2009 libsqlplus.dylib
-rwxr-xr-x@  1 janhellevik  staff   1442316 Feb 11  2009 libsqlplusic.dylib
drwxr-xr-x   3 janhellevik  staff       102 Sep  5 15:37 network
-r--r--r--@  1 janhellevik  staff   1555682 Feb  2  2008 ojdbc14.jar
-rw-r-----   1 janhellevik  staff      1556 Sep  5 15:41 sqlnet.log
-rwxr-xr-x@  1 janhellevik  staff     12612 Mar 25  2009 sqlplus
macpro:instantclient_10_2 janhellevik$

Create tnsnames.ora

Here is an example (replace host.domain.com and orcl.domain.com with the real thing):

orcl =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = host.domain.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.domain.com)
    )
  )

Modify .profile

# ORACLE client
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Applications/instantclient_10_2
export TNS_ADMIN=/Applications/instantclient_10_2/network/admin
export PATH=$PATH:/Applications/instantclient_10_2
# ORACLE client

Test

Open a terminal window and try it:

macpro:~ janhellevik$ sqlplus user/password@orcl

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Sep 5 16:09:32 2011

Copyright (c) 1982, 2007, 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 v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE	11.2.0.1.0	Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
macpro:~ janhellevik$

 

Comments (4)

  1. 03:28, 2011/10/04amar 

    where do i get the host.domain.com and orcl.domain.com names and username and password from?

    • 20:04, 2011/10/16jan 

      You get them from the database installation. If you installed it yourself, you know what they are. If not, ask your dba.

  2. 02:28, 2011/11/11Harry 

    instant client doesn’t come with tnsping. Personally, I rather go with an oracle db client instead.

  3. 14:44, 2011/12/31jan 

    Good point, Harry. I did an install of the ‘regular’ client also – click here to read it.

Pingbacks (0)

› No pingbacks yet.

Switch to our mobile site