Oracle Instant Client and SQL Plus on Snow Leopard or Lion

by Bruce on July 6, 2011

  • Download the 32 bit flavor of “basiclite”, sqlplus, the sdk, and jdbc (if you need it) from download.oracle.com Note: as of 10.2, 64 bit works on snow leopard but not lion.
  • unzip the downloads and place them somewhere out of the way like /Applications/Develop/oracle  the files should be combined into a single folder.  In my case /Applications/Develop/oracle/instantclient_10_2
    this is a strange place, a personal quirk of mine, put it wherever you’d like, just make the appropriate adjustments below.

    unzip instantclient-basic-macosx-10.2.0.4.0.zip
    unzip instantclient-sqlplus-macosx-10.2.0.4.0.zip
    unzip instantclient-sdk-macosx-10.2.0.4.0.zip
    unzip instantclient-jdbc-macosx-10.2.0.4.0.zip
  • make links
    cd instantclient_10_2
    ln -s libclntsh.dylib.10.1 libclntsh.dylib
    ln -s libocci.dylib.10.1 libocci.dylib
  • setup some environment variables… edit your ~/.profile
    # oracle
    export DYLD_LIBRARY_PATH="/Applications/Develop/oracle/instantclient_10_2"
    export SQLPATH="/Applications/Develop/oracle/instantclient_10_2"
    export TNS_ADMIN="/Applications/Develop/oracle/network/admin"
    #export NLS_LANG="AMERICAN_AMERICA.UTF8"
    export PATH=$PATH:$DYLD_LIBRARY_PATH
  • setup a tnsnames.ora in /Applications/Develop/oracle/network (or elsewhere just fix TNS_ADMIN export line above)
  • populate it with something – you’re on your own here unless you happen to be using the ldstech oracle vm, then use this…
    xe=
      (DESCRIPTION=
        (ADDRESS_LIST=
          (ADDRESS=
            (PROTOCOL=TCP)
            (HOST=192.168.56.101)
            (PORT=1521)
          )
        )
        (CONNECT_DATA=
          (SID=xe)
        )
      )
  • restart terminal and test a connection with something like sqlplus username@sid

{ 3 comments… read them below or add one }

Bruce July 7, 2011 at 12:17 pm

The sdk component of the instant client download is needed for things like installing the ruby-oci8 gem. If you don’t you’ll get a message like…
Error Message: ‘/Applications/Develop/oracle/instantclient_10_2/sdk/include/oci.h’ does not exist. Install ‘Instant Client SDK’.

julia shozen January 30, 2012 at 4:06 pm

If you have no Oracle Database installed but using client services to connect to Amazon RDS,
how is that set up in the TNSNames.ora. My guess is:
SID = myinstance
(Host =myinstance.valuesfromendpoint.rds.amazonawas.com)

Thanks, I just need a few more clues. The above seems helpful, I will try it. I have already connected with SQLDeveloper tool but I really do prefer working in SQL*Plus.

Julia

TC January 30, 2014 at 10:36 am

1/30/14 Perfect instructions Thank you.

Leave a Comment

Previous post:

Next post: