各平台下oracle-instant-client安装部署
1.1 方式一:Oracle Instant Client Zip
-
Download an Oracle 19, 18, 12, or 11.2 “Basic” or “Basic Light” zip file: 64-bit or 32-bit, matching your application 64-bit or 32-bit architecture.
-
Unzip the package into a directory that is accessible to your application. For example:
mkdir -p /opt/oracle cd /opt/oracle unzip instantclient-basic-linux.x64-19.3.0.0.0dbru.zip
-
Install the operating system
libaio
package with sudo or as the root user. For example:sudo yum install libaio
On some Linux distributions this package is called
libaio1
instead. -
If there is no other Oracle software on the machine that will be impacted, permanently add Instant Client to the runtime link path. For example, with sudo or as the root user:
sudo sh -c "echo /opt/oracle/instantclient_19_3 > /etc/ld.so.conf.d/oracle-instantclient.conf" sudo ldconfig
Alternatively, set the environment variable
LD_LIBRARY_PATH
to the appropriate directory for the Instant Client version. For example:export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_3:$LD_LIBRARY_PATH
-
If you intend to co-locate optional Oracle configuration files such as
tnsnames.ora
,sqlnet.ora
ororaaccess.xml
with Instant Client, then create anetwork/admin
subdirectory, if it does not exist. For example:mkdir -p /opt/oracle/instantclient_12_2/network/admin
This is the default Oracle configuration directory for applications linked with this Instant Client.
Alternatively, Oracle configuration files can be put in another, accessible directory. Then set the environment variable
TNS_ADMIN
to that directory name.
1.2 方式二:Oracle Instant Client RPM
-
Download an Oracle 19, 18, 12, or 11.2 “Basic” or “Basic Light” RPM: 64-bit or 32-bit, matching your application architecture.
Oracle’s yum server has Instant Client RPMs for Oracle Linux 7 and Instant Client RPMs for Oracle Linux 6 that can be downloaded without needing a click-through.
-
Install the downloaded RPM with sudo or as the root user. For example:
sudo yum install oracle-instantclient19.3-basic-19.3.0.0.0-1.x86_64.rpm
Yum will automatically install required dependencies, such as
libaio
.Oracle Linux users can alternatively automate download and installation. For example:
yum -y install oracle-release-el7 yum-config-manager --enable ol7_oracle_instantclient yum -y install oracle-instantclient19.3-basic
-
For Instant Client 19 RPMs, the system library search path is automatically configured during installation.
For older versions, if there is no other Oracle software on the machine that will be impacted, permanently add Instant Client to the runtime link path. For example, with sudo or as the root user:
sudo sh -c "echo /usr/lib/oracle/18.5/client64/lib > /etc/ld.so.conf.d/oracle-instantclient.conf" sudo ldconfig
Alternatively, for version 18 and earlier, every shell will need to have the environment variable
LD_LIBRARY_PATH
set to the appropriate directory for the Instant Client version. For example:export LD_LIBRARY_PATH=/usr/lib/oracle/18.5/client64/lib:$LD_LIBRARY_PATH
-
If you intend to co-locate optional Oracle configuration files such as
tnsnames.ora
,sqlnet.ora
ororaaccess.xml
with Instant Client, then create anetwork/admin
subdirectory underlib/
, if it does not exist. For example:sudo mkdir -p /usr/lib/oracle/12.2/client64/lib/network/admin
This is the default Oracle configuration directory for applications linked with this Instant Client.
Alternatively, Oracle configuration files can be put in another, accessible directory. Then set the environment variable
TNS_ADMIN
to that directory name.
1.3 Local Database or Full Oracle Client
ODPI-C applications can use Oracle Client 19, 18, 12, or 11.2 libraries from a local Oracle Database or full Oracle Client installation.
The libraries must be either 32-bit or 64-bit, matching your application and ODPI-C library (if one is created separately).
-
Set required Oracle environment variables by running the Oracle environment script. For example:
source /usr/local/bin/oraenv
For Oracle Database XE 11.2, run:
source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
-
Optional Oracle configuration files such as
tnsnames.ora
,sqlnet.ora
ororaaccess.xml
can be placed in$ORACLE_HOME/network/admin
.Alternatively, Oracle configuration files can be put in another, accessible directory. Then set the environment variable
TNS_ADMIN
to that directory name.
二、windows
ODPI-C requires Oracle Client libraries, which are found in Oracle Instant Client, or an Oracle Database installation, or in a full Oracle Client installation. The libraries must be either 32-bit or 64-bit, matching your application and ODPI-C library (if one is created separately).
On Windows, ODPI-C looks for the Oracle Client library “OCI.dll” first in the directory containing the ODPI-C library (or application), and then searches using the standard library search order.
Oracle Client libraries require the presence of the correct Visual Studio redistributable.
Oracle 19 needs VS 2017
Oracle 18 and 12.2 need VS 2013
Oracle 12.1 needs VS 2010
Oracle 11.2 needs VS 2005 64-bit or VS 2005 32-bit
2.1 Oracle Instant Client Zip
-
Download an Oracle 19, 18, 12, or 11.2 “Basic” or “Basic Light” zip file: 64-bit or 32-bit, matching your application architecture.
Note that 19c is not supported on Windows 7.
-
Unzip the package into a directory that is accessible to your application. For example unzip
instantclient-basic-windows.x64-19.3.0.0.0dbru.zip
toC:\oracle\instantclient_19_3
. -
Add this directory to the
PATH
environment variable. For example, on Windows 7, updatePATH
in Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables -> System Variables -> PATH. The Instant Client directory must occur inPATH
before any other Oracle directories.Restart any open command prompt windows.
To avoid interfering with existing tools that require other Oracle Client versions, instead of updating the system-wide
PATH
variable, you may prefer to write a batch file that setsPATH
, for example:REM mywrapper.bat SET PATH=C:\oracle\instantclient_19_3;%PATH% myapp %*
Invoke this batch file everytime you want to run your application.
Alternatively use
SET
to change yourPATH
in each command prompt window before you run python.Another option is to move the unzipped Instant Client files to the same directory as the ODPIC.DLL (or into the directory of the application’s binary, if ODPI-C is compiled into application). If you do this, then
PATH
does not need to be set. -
If you intend to co-locate optional Oracle configuration files such as
tnsnames.ora
,sqlnet.ora
ororaaccess.xml
with Instant Client, then create anetwork\admin
subdirectory, if it does not exist, for exampleC:\oracle\instantclient_19_3\network\admin
.This is the default Oracle configuration directory for applications linked with this Instant Client.
Alternatively, Oracle configuration files can be put in another, accessible directory. Then set the environment variable
TNS_ADMIN
to that directory name.
If you wish to package Instant Client with your application, you can move the Instant Client libraries to the same directory as the ODPI-C library (or application). Refer to the Instant Client documentation for the minimal set of Instant Client files required. There is no need to set PATH
. This only works on Windows.
2.2 Local Database or Full Oracle Client
The Oracle libraries must be either 32-bit or 64-bit, matching your application and ODPI-C library (if one is created separately).
To run ODPI-C applications using client libraries from a local Oracle Database (or full Oracle Client) 19, 18, 12, or 11.2 installation:
-
Set the environment variable
PATH
to include the path that contains OCI.dll, if it is not already set. For example, on Windows 7, updatePATH
in Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables -> System Variables -> PATH.Restart any open command prompt windows.
-
Optional Oracle configuration files such as
tnsnames.ora
,sqlnet.ora
ororaaccess.xml
can be placed in thenetwork/admin
subdirectory of the Oracle software.Alternatively, Oracle configuration files can be put in another, accessible directory. Then set the environment variable
TNS_ADMIN
微信赞赏
![](https://oss-pic.oss-cn-hangzhou.aliyuncs.com/wepayrandom_380.jpg)
支付宝赞赏
![](https://oss-pic.oss-cn-hangzhou.aliyuncs.com/alipayrandom_380.jpg)