install Oracle and cx_oracle on Mac

steps
Oracle InstantClient installation
$ unzip instantclient-basic-macosx-10.1.0.3.zip
$ unzip instantclient-sqlplus-macosx-10.1.0.3.zip
$ cd instantclient10_1
$ ln -s libclntsh.dylib.10.1 libclntsh.dylib
$ ln -s libocci.dylib.10.1 libocci.dylib
$ cd..
$ sudo mkdir /usr/local/oracle
$ sudo mv instantclient10_1 /usr/local/oracle/instantclient10_1
$ sudo pico /etc/profile
(add)

#Oracle settings
ORACLE_HOME=”/usr/local/oracle”
export ORACLE_HOME

DYLD_LIBRARY_PATH=”/usr/local/oracle/instantclient10_1″
export DYLD_LIBRARY_PATH

SQLPATH=”/usr/local/oracle/instantclient10_1″
export SQLPATH

export PATH=”$PATH:/usr/local/oracle/instantclient10_1″

$ source /etc/profile
$ sqlplus
$ sudo mkdir -p /b/729/rdbms/lib/
$ sudo ln -s /usr/local/oracle/instantclient10_1/libclntsh.dylib.10.1 /b/729/rdbms/lib/libclntsh.dylib.10.1

cx_Oracle installation

$ cd cx_Oracle-4.2/
$ sudo python setup.py build
$ sudo python setup.py install

Important link:

From: http://pedro.emanuel.familiasalgado.org/?p=103

1 使用正确的环境编译MySQL-python-1.2.3.tar.gz,并安装
设置.bash_profile

1 PATH="/usr/local/mysql/bin:${PATH}"
2 export PATH
3 export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
4 export VERSIONER_PYTHON_PREFER_64_BIT=yes
5 export VERSIONER_PYTHON_PREFER_32_BIT=no

2 编译安装cx_Oracle lib

1 ARCHFLAGS="-arch x86_64" python setup.py build#64bit使用这个
2 ARCHFLAGS="-arch i386" python setup.py build#32bit使用这个
3  
4 sudo python setup.py install

3 开发环境IDE里设置DYLD_LIBRARY_PATH

1 export DYLD_LIBRARY_PATH=/usr/local/oracle/lib/




Oracle's instantclient installation instructions specify that the user set DYLD_LIBRARY_PATH. This is very troublesome to manage for multiple users.

To use the instantclient without setting any environment variables:

Download the instantclient distribution from oracle.com. For doing non-java software development, you will need (assuming Oracle 10.2):

instantclient-basic-macosx-10.2.0.4.0.zip
instantclient-sdk-macosx-10.2.0.4.0.zip
instantclient-sqlplus-macosx-10.2.0.4.0.zip

Unzip the three files. This will give you a directory

instantclient_10_2/

Copy the files to /usr, which is one of the default places the dynamic loader searches.

sudo cp instantclient_10_2/sdk/include/*.h /usr/include
sudo cp instantclient_10_2/sqlplus         /usr/bin
sudo cp instantclient_10_2/*.dylib         /usr/lib

If you use tnsnames.ora, copy it to /etc, which is the default global place the oracle runtime searches.

sudo cp tnsnames.ora /etc

Test with

/usr/bin/sqlplus scott/tiger@myoracle

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值