在 Mac OS/X 上安装 Oracle Instantclient 而不设置环境变量?

2021-12-23 00:00:00 macos installation oracle instantclient

Oracle 的说明指定了设置 DYLD_LIBRARY_PATH.这使得我的应用依赖于随机用户的配置,设置起来非常麻烦.

Oracle's instructions specify setting DYLD_LIBRARY_PATH. This makes my application dependent on random users' configuration and is very troublesome to set up.

如何避免设置任何环境变量?

How can I avoid having to set any environment variables?

http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/intel_macsoft.html

Linux 相关说明:在 Linux 上安装 Oracle Instantclient 而不设置环境变量?

related note for linux: installing Oracle Instantclient on Linux without setting environment variables?

推荐答案

Oracle 的 Instantclient 安装说明指定用户设置 DYLD_LIBRARY_PATH.这对于多个用户的管理非常麻烦.

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:

从 oracle.com 下载 Instantclient 发行版.要进行非 Java 软件开发,您需要(假设为 Oracle 10.2):

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/

将文件复制到/usr,这是动态加载程序搜索的默认位置之一.

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

如果您使用 tnsnames.ora,请将其复制到/etc,这是 oracle 运行时搜索的默认全局位置.

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

sudo cp tnsnames.ora /etc

测试

/usr/bin/sqlplus scott/tiger@myoracle

相关文章