sh 在MacOSX上安装Oracle即时客户端(sqlplus)v12.1

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 在MacOSX上安装Oracle即时客户端(sqlplus)v12.1相关的知识,希望对你有一定的参考价值。

# Install Oracle instant client (sqlplus) on MacOSX

1. Get Oracle instant client for MacOSX
  - Go to the download site - http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
  - Download "instantclient-basic-macos.x64-12.1.0.2.0.zip"
  - Download "instantclient-sqlplus-macos.x64-12.1.0.2.0.zip"
  - Download "instantclient-sdk-macos.x64-12.1.0.2.0.zip"
2. Unarchive downloaded zip files into a same directory
  - ex: `$HOME/Downloads/instantclient_12_1`
3. Create `install.sh` and copy the following code and past it on that file.
4. Run `source /usr/local/share/instantclient/instantclient.sh`
5. Run `sqlplus` to check if you can run "sqlplus" in any place 
6. Add `source /usr/local/share/instantclient/instantclient.sh` to your .bashrc
#!/bin/bash

set -e
export ORACLE_VERSION="12.1.0.2.0"
mkdir -p /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/bin
mkdir -p /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/lib
mkdir -p /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/jdbc/lib
mkdir -p /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/rdbms/jlib
mkdir -p /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/sqlplus/admin

mv sdk /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/lib/
mv ojdbc* /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/jdbc/lib/
mv x*.jar /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/rdbms/jlib/
mv glogin.sql /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/sqlplus/admin/
mv *dylib* /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/lib/
mv *README /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/
mv * /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/bin/
cd /usr/local/bin
ln -s ../Oracle/product/instantclient/$ORACLE_VERSION/bin/sqlplus sqlplus

cd /usr/local/Oracle/product/instantclient/$ORACLE_VERSION
mkdir -p share/instantclient
cd /usr/local/share
ln -s ../Oracle/product/instantclient/$ORACLE_VERSION/share/instantclient/ instantclient
cd /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/lib
ln -s libclntsh.dylib.12.1 libclntsh.dylib

echo "
export ORACLE_BASE=/usr/local/Oracle
export ORACLE_HOME=\$ORACLE_BASE/product/instantclient/$ORACLE_VERSION
export DYLD_LIBRARY_PATH=\$ORACLE_HOME/lib
export OCI_DIR=\$DYLD_LIBRARY_PATH
export TNS_ADMIN=\$ORACLE_BASE/admin/network
" > /usr/local/share/instantclient/instantclient.sh

echo "Done!"
echo
echo "Next step:  Add the following code to your ~/.bashrc"
echo "source /usr/local/share/instantclient/instantclient.sh"

以上是关于sh 在MacOSX上安装Oracle即时客户端(sqlplus)v12.1的主要内容,如果未能解决你的问题,请参考以下文章

安装oracle即时客户端

markdown 安装Oracle PHP扩展(oracle OCI8) - 适用于Mac OS 10.12.6的即时客户端 - 自制环境 - 在PHP 7.2上

安装oracle即时客户端

Oracle Instant Client(即时客户端) 安装与配置

Oracle 即时客户端 DYLD_LIBRARY_PATH 错误

Mac OS X上的Oracle 11g