各平台下oracle-instant-client安装部署

一、linux平台

1.1 方式一:Oracle Instant Client Zip

  1. 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.

  2. 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
  3. 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.

  4. 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
  5. If you intend to co-locate optional Oracle configuration files such as tnsnames.ora, sqlnet.ora or oraaccess.xml with Instant Client, then create a network/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

  1. 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.

  2. 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
  3. 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
  4. If you intend to co-locate optional Oracle configuration files such as tnsnames.ora, sqlnet.ora or oraaccess.xml with Instant Client, then create a network/admin subdirectory under lib/, 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).

  1. 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
  2. Optional Oracle configuration files such as tnsnames.ora, sqlnet.ora or oraaccess.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.

 

2.1 Oracle Instant Client Zip

  1. 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.

  2. 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 to C:\oracle\instantclient_19_3.

  3. Add this directory to the PATH environment variable. For example, on Windows 7, update PATH in Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables -> System Variables -> PATH. The Instant Client directory must occur in PATH 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 sets PATH, 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 your PATH 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.

  4. If you intend to co-locate optional Oracle configuration files such as tnsnames.ora, sqlnet.ora or oraaccess.xml with Instant Client, then create a network\admin subdirectory, if it does not exist, for example C:\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:

  1. Set the environment variable PATH to include the path that contains OCI.dll, if it is not already set. For example, on Windows 7, update PATH in Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables -> System Variables -> PATH.

    Restart any open command prompt windows.

  2. Optional Oracle configuration files such as tnsnames.ora, sqlnet.ora or oraaccess.xml can be placed in the network/admin subdirectory of the Oracle software.

    Alternatively, Oracle configuration files can be put in another, accessible directory. Then set the environment variable TNS_ADMIN to that directory name.

猜你喜欢

转载自www.cnblogs.com/lkj371/p/12793463.html