【Service】【Database】【Oracle】Oracle client 12.1.0.2 for MacOS

1. 概述:为了在个人macos上搭建python的cx_Oracle开发环境,首先须要配置oracle clienthtml

 

2. 环境与版本:java

2.1. OS:Mac OS Sierra 10.12.2python

2.2. JDK:1.8.0_91sql

2.3. Oracle client:Version 12.1.0.2 (64-bit) Updated 1/4/17  for Mac OS X (Intel x86)macos

PS:oracle网站的下载须要注册一个帐户。请自行申请。下载bash

basic:http://download.oracle.com/otn/mac/instantclient/121020/instantclient-basic-macos.x64-12.1.0.2.0.ziporacle

JDBC:http://download.oracle.com/otn/mac/instantclient/121020/instantclient-jdbc-macos.x64-12.1.0.2.0.zip工具

sqlplus:http://download.oracle.com/otn/mac/instantclient/121020/instantclient-sqlplus-macos.x64-12.1.0.2.0.zip网站

odbc(可选):http://download.oracle.com/otn/mac/instantclient/121020/instantclient-odbc-macos.x64-12.1.0.2.0.zipspa

sdk(可选):http://download.oracle.com/otn/mac/instantclient/121020/instantclient-sdk-macos.x64-12.1.0.2.0.zip

Tools(可选):http://download.oracle.com/otn/mac/instantclient/121020/instantclient-tools-macos.x64-12.1.0.2.0.zip

 

这个是预编译版本,貌似须要pro*c,想深刻了解的同窗能够本身试试这个

http://www.oracle.com/technetwork/topics/precomp-112010-084940.html

2.4. cx_Oracle:cx_Oracle-5.2.1.tar.gz(须要使用brew安装pip或者pip3,再使用pip安装)(略)

 

3. 安装

3.1 MacOS安装:(略)

3.2 JDK安装:能够不装,不过为了让java的环境也能够正常运行,jdbc和java都要装上(略)

3.3 Oracle client:

#建立一个目录,把zip包都拷贝过来
mkdir /usr/local/oracle/
cd /usr/local/oracle/
mv /Users/eric/Downloads/instantclient-* .

#解压到当前文件夹,四个包会解压到一个文件夹里
unzip instantclient-basic-macos.x64-12.1.0.2.0.zip #提供基本功能
unzip instantclient-sqlplus-macos.x64-12.1.0.2.0.zip #提供sqlplus命令行
unzip instantclient-jdbc-macos.x64-12.1.0.2.0.zip #提供jdbc
unzip instantclient-tools-macos.x64-12.1.0.2.0.zip unzip instantclient-sdk-macos.x64-12.1.0.2.0.zip #提供头文件,cx_Oracle会依赖其中的oci.h


#进入到解压的目录中,链接一下库文件
cd instantclient_12_1
ln -s libclntsh.dylib.12.1 libclntsh.dylib
ln -s libocci.dylib.12.1 libocci.dylib

#修改profile文件,增长oracle客户端的目录和LD的库路径
export PATH=/usr/local/oracle/instantclient_12_1:$PATHexport DYLD_LIBRARY_PATH=/usr/local/oracle/instantclient_11_2:$DYLD_LIBRARY_PATHsource /etc/profile#能够安装cx_Oracle了,我这有python2和3两个版本,因此两个都要安装pip install cx_Oraclepip3 install cx_Oracle#sqlplus工具也能够使用了
相关文章
相关标签/搜索