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

时间:2021-06-22 22:47:20

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

Oracle的指令指定设置DYLD_LIBRARY_PATH。这使得我的应用程序依赖于随机用户的配置,设置起来非常麻烦。

How can I avoid having to set any environment variables?

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

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

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

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

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

3 个解决方案

#1


23  

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

Oracle的instantclient安装指令指定用户设置DYLD_LIBRARY_PATH。对于多个用户来说,这非常麻烦。

To use the instantclient without setting any environment variables:

使用instantclient而不设置任何环境变量:

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

从oracle.com下载instantclient分布。对于非java软件开发,您需要(假设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.

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

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.

如果你使用以及。ora,复制到/etc,这是oracle运行时搜索的默认全局位置。

sudo cp tnsnames.ora /etc

Test with

测试

/usr/bin/sqlplus scott/tiger@myoracle

#2


2  

If your goal is simply to run sqlplus on your MacBook, this might work for you. Remove the DYLD_LIBRARY_PATH environment variable from ~/.bashrc and replace it with an alias:

如果你的目标仅仅是在你的MacBook上运行sqlplus,这可能对你有用。从~/中删除DYLD_LIBRARY_PATH环境变量。bashrc并替换为别名:

alias sqlplus="DYLD_LIBRARY_PATH=/Applications/instantclient_11_2 sqlplus"

别名sqlplus = " DYLD_LIBRARY_PATH = /应用程序/ instantclient_11_2 sqlplus”

Blog entry: sqlplus and DYLD_LIBRARY_PATH on Mac OS/X

博客条目:Mac OS/X上的sqlplus和DYLD_LIBRARY_PATH。

#3


0  

After much research I found an sustainable solution to this error, that involves editing Apache's launchd configuration .plist file to specify the required DYLD_LIBRARY_PATH, ORACLE_HOME, and LD_LIBRARY_PATH environment variables.

经过大量研究,我找到了一个解决这个错误的可持续解决方案,它涉及编辑Apache的launchd配置.plist文件,以指定所需的DYLD_LIBRARY_PATH、ORACLE_HOME和LD_LIBRARY_PATH环境变量。

You can view the full answer here: https://*.com/a/20670810/1914455

您可以在这里查看完整的答案:https://*.com/a/20670810/1914455

#1


23  

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

Oracle的instantclient安装指令指定用户设置DYLD_LIBRARY_PATH。对于多个用户来说,这非常麻烦。

To use the instantclient without setting any environment variables:

使用instantclient而不设置任何环境变量:

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

从oracle.com下载instantclient分布。对于非java软件开发,您需要(假设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.

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

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.

如果你使用以及。ora,复制到/etc,这是oracle运行时搜索的默认全局位置。

sudo cp tnsnames.ora /etc

Test with

测试

/usr/bin/sqlplus scott/tiger@myoracle

#2


2  

If your goal is simply to run sqlplus on your MacBook, this might work for you. Remove the DYLD_LIBRARY_PATH environment variable from ~/.bashrc and replace it with an alias:

如果你的目标仅仅是在你的MacBook上运行sqlplus,这可能对你有用。从~/中删除DYLD_LIBRARY_PATH环境变量。bashrc并替换为别名:

alias sqlplus="DYLD_LIBRARY_PATH=/Applications/instantclient_11_2 sqlplus"

别名sqlplus = " DYLD_LIBRARY_PATH = /应用程序/ instantclient_11_2 sqlplus”

Blog entry: sqlplus and DYLD_LIBRARY_PATH on Mac OS/X

博客条目:Mac OS/X上的sqlplus和DYLD_LIBRARY_PATH。

#3


0  

After much research I found an sustainable solution to this error, that involves editing Apache's launchd configuration .plist file to specify the required DYLD_LIBRARY_PATH, ORACLE_HOME, and LD_LIBRARY_PATH environment variables.

经过大量研究,我找到了一个解决这个错误的可持续解决方案,它涉及编辑Apache的launchd配置.plist文件,以指定所需的DYLD_LIBRARY_PATH、ORACLE_HOME和LD_LIBRARY_PATH环境变量。

You can view the full answer here: https://*.com/a/20670810/1914455

您可以在这里查看完整的答案:https://*.com/a/20670810/1914455