Skip to content

Instantly share code, notes, and snippets.

@nycynik
Last active February 29, 2016 16:38
Show Gist options
  • Save nycynik/8a96db26650b9761d401 to your computer and use it in GitHub Desktop.
Save nycynik/8a96db26650b9761d401 to your computer and use it in GitHub Desktop.
A (destructive) method of installing oracle on a mac. This installs oracle to /opt/oracle/instantclient, and destroys any existing /opt/oracle/instantclient* folders. It also sets up the enviornment to use the newly installed oracle, however it does not set your .bash_profile up for the next time you need it. This script needs to be run from the…
OLD_PWD=$(pwd)
echo "Installing Oracle.."
sudo rm -rf /opt/oracle/instantclient*
sudo mkdir -p /opt/oracle
sudo unzip instantclient-\*.zip -d /opt/oracle/
cd /opt/oracle
for FILE in /opt/oracle/instant*; do
if [[ -d $FILE ]]; then
ORACLE_INST_FOLDER=$FILE
fi
done
echo "Found instant client in $ORACLE_INST_FOLDER"
sudo ln -s $ORACLE_INST_FOLDER /opt/oracle/instantclient
sudo find /opt/oracle/ -name "liblntsh.dynlib.*" -exec ln -s '{}' libclntsh.dynlib \;
sudo find /opt/oracle/ -name "libocci.dylib.*" -exec ln -s '{}' libocci.dynlib \;
# oracle
export ORACLE_HOME=/opt/oracle/instantclient
export DYLD_LIBRARY_PATH=$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME
export PATH=$PATH:$ORACLE_HOME
echo "Done"
cd $OLD_PWD
# oracle
export ORACLE_HOME=/opt/oracle/instantclient
export DYLD_LIBRARY_PATH=$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME
export NLS_LANG=AMERICAN_AMERICA.UTF8
export TNS_ADMIN=$HOME/etc
export PATH=$PATH:$ORACLE_HOME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment