SQL*PLus on Mac

December 1st, 2016

I would think installing SQL*Plus on the Mac would be point, click download, point click, install bam it works.

Nah

It did install mostly straight forward on my old Mac. Got a new Mac and no dice.

Tried installing myself guessing at the downloads. First of all why isn’t there just one download?

Downloaded instantclient and instantclient with SQL*Plus which turns out to be correct, but no dice. Still got errors.

Got errors. Gave up.

Came back again to look at it yesterday and followed this:

https://tomeuwork.wordpress.com/2014/05/12/how-to-install-oracle-sqlplus-and-oracle-client-in-mac-os/

worked like a charm.

Then I ran a shell script that used SQL*Plus oramon.sh and get the error

dyld: Library not loaded: /ade/dosulliv_sqlplus_mac/oracle/sqlplus/lib/libsqlplus.dylib
Referenced from: /Applications/oracle/product/instantclient_64/11.2.0.4.0/bin/sqlplus
Reason: image not found

so I set my environment variable

export DYLD_LIBRARY_PATH=$ORACLE_HOME/lib

Let’s check the environment variable:

$ env | grep LIB
$

Huh?! Where is my environment variable?

Apparently you can’t set DYLD_LIBRARY_PATH on Mac without over riding some security settings which didn’t sound attractive.

I googled around and found

https://blog.caseylucas.com/2013/03/03/oracle-sqlplus-and-instant-client-on-mac-osx-without-dyld_library_path/

which didn’t work for me. Then found

https://blogs.oracle.com/taylor22/entry/sqlplus_and_dyld_library_path

which has as a solution to set the library path inside an alias for SQL*Plus – cool!

alias sqlplus=”DYLD_LIBRARY_PATH=/Applications/oracle/product/instantclient_64/11.2.0.4.0/lib sqlplus”

and I put that into my ~/.bashrc and it worked!


Uncategorized

  1. Trackbacks

  2. No trackbacks yet.
  1. Comments

  2. | #1

    Hi.

    Maybe you should have used SQLcl?

    http://www.oracle.com/technetwork/developer-tools/sqlcl/overview/index.html

    Cheers

    Tim…

  3. Niggle
    | #2

    @Tim Hall
    Hi Tim,
    looking just at the title of this post, I was going to reply the same thing :)

    A lot of info here also: http://krisrice.blogspot.fr/

    Cheers!
    N.

  4. Dave
    | #3

    I simply added the following to my .profile:
    export DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2:$DYLD_LIBRARY_PATH

    I don’t recall having to do anything special to override Mac security, but it’s been a while, so I may forgotten it by now.

    In any case, sqlplus works fine from bash. I haven’t called it from a shell script or cron job, however.

    Dave

  5. khailey
    | #4

    Hi Tim,

    Thanks for the comment. I didn’t try SQLcl. I saw in the digging around for the SQL*Plus error solutions that it was mentioned. The main reason I didn’t tied it is the scrips I use depend on a lot of SQL*PLus setting and figured the chance of SQLcl being completely compatible were slim, but then again I didn’t actually try it.

  6. khailey
    | #5

    Hi Dave,
    Thanks for the feedback.
    Maybe the reason sqlplus worked on my old Mac was because it was an older OS version and now security is higher – not sure.
    Now however, if I set DYLD_LIBRARY_PATH in my .profile it doesn’t care over into my subshells.
    I can get sqlplus to run in my login shell but not inside of scripts.
    Hard coding DYLD_LIBRARY_PATH in the scripts works, but that’s a bit brittle.
    I though the alias solutions was pretty nifty.


− 4 = three