Skip to content

Instantly share code, notes, and snippets.

@haydnhkim
Forked from floer32/centos_cx_Oracle
Last active March 22, 2017 13:46
Show Gist options
  • Save haydnhkim/f6e8b1c66ce623ea23f6 to your computer and use it in GitHub Desktop.
Save haydnhkim/f6e8b1c66ce623ea23f6 to your computer and use it in GitHub Desktop.
#!/bin/bash
# INSTALL ORACLE INSTANT CLIENT #
#################################
# NOTE: Oracle requires at least 1176 MB of swap (or something around there).
echo "Now go get some the following two zip files ..."
echo "- basic: instantclient-basic-macos.x64-11.2.0.4.0.zip"
echo "- SDK/devel: instantclient-sdk-macos.x64-11.2.0.4.0.zip"
echo "... from this URL: http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html"
echo "WARNING: It's pretty annoying, they make you sign up for an Oracle account, etc."
echo 'I will assume you have put these two files are into ~/Downloads'
echo "Press any key once you're ready" && read -n 1 -s
# SET ENVIRONMENT VARIABLES #
#############################
# Source for this section: http://cx-oracle.sourceforge.net/BUILD.txt
echo '' >> $HOME/.bash_profile
echo '# Convoluted undocumented Oracle bullshit.' >> $HOME/.bash_profile
echo 'export ORACLE_HOME=$HOME/oracle' >> $HOME/.bash_profile
echo 'export LD_LIBRARY_PATH=$ORACLE_HOME' >> $HOME/.bash_profile
echo 'export DYLD_LIBRARY_PATH=$ORACLE_HOME' >> $HOME/.bash_profile
. $HOME/.bash_profile
# install oracle instant client
mkdir -p $ORACLE_HOME
cd $ORACLE_HOME
cp ~/Downloads/instantclient-basic-* $ORACLE_HOME
cp ~/Downloads/instantclient-sdk-* $ORACLE_HOME
tar -xvzf $ORACLE_HOME/instantclient-basic-*
tar -xvzf $ORACLE_HOME/instantclient-sdk-*
mv instantclient_11_2/* .
mv sdk/* .
ln -s libclntsh.dylib.11.1 libclntsh.dylib
ln -s libocci.dylib.11.1 libocci.dylib
# INSTALL cx_Oracle #
#####################
pip install cx_Oracle
@atomic77
Copy link

Thanks for posting this - I was getting a linker error when trying to install cx-Oracle:

 ld: library not found for -lclntsh
 clang: error: linker command failed with exit code 1 (use -v to see invocation)
 error: command 'clang' failed with exit status 1

All I needed in my environment was to set ORACLE_HOME to where I unpacked the instant client zips (basic + sdk) and manually create the symlink for libclntsh.dylib and it worked.

Now I think I will go take a shower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment