TheOracle Instant Client is a light-weight, freely distributable implementation of an Oracle client. A big advantage of the Instant Client is it does not need a formal installation. Instead, it can be unzipped and used without any fuss.
Since September 2018 the instant client RPMs have been freely available on
yum.oracle.com. If you are using Oracle Linux and have root access you can install the instant client using Yum with a few simple commands.
There are a number of downloads available, depending on which features you require. The Linux versions also come with an RPM option, but as this requires root privilege to install, it may not be considered so desirable. The basic download provides all the core functionality necessary to make basic connections from Java. In this case, I wanted to make SQL*Plus connections, so I downloaded the following zip files.
When using the Instant Client, we need to make sure the LD_LIBRARY_PATH environment variable is set to point to the location where the software was unzipped. In this case, I also set the PATH environment variable.
If you would prefer to use a "tnsnames.ora" file, you can do that too. Just set the TNS_ADMIN environment variable to the directory holding the file and it will work as expected. For example, imagine I had a "tnsnames.ora" file in my home directory with the following contents.
How can I install Oracle's imp / exp binaries to my CentOS box without installing an Oracle Server? I'm accessing an existing Oracle database on another machine, so I only need a client here. I already installed sqlplus and its dependencies (oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm, and oracle-instantclient11.2-odbc-11.2.0.3.0-1.x86_64.rpm), but that didn't provide those tools.
My aim is to suck a database dump from the Oracle to my CentOS box. If there is another way to do this without using exp I wouldn't feel bad about NOT using it, but it seems to me there is no alternative.
NOTE: exports/dumps are not true backups. They are only logical copies of the database. The meta-data and indexes get re-created during import and so won't be byte-for-byte identical to the source database.
A simple connection to the database requires an OracleDatabase user name and password and a databaseconnection string. For python-oracledb, a commonconnection string format is hostname:port/servicename, using the hostname where the database is running, the Oracle Database service name of thedatabase instance, and the port that the database is using. If the defaultport 1521 is being used, then this component of the connection string isoften omitted.
When python-oracledb is used in the default Thin mode, it connects directly tothe Oracle Database and does not require Oracle Client libraries. Connectionsin this mode can be made to Oracle Database 12.1 or later.
Any attempt to use Oracle Database features that are not supported by aparticular mode or client library/database combination will result in runtimeerrors. The python-oracledb attribute Connection.thin can be used tosee what mode a connection is in. In the Thick mode, the functionoracledb.clientversion() can be used to determine which Oracle Clientversion is in use. The attribute Connection.version can be used todetermine which Oracle Database version a connection is accessing. Theseattributes can then be used to adjust the application behavior accordingly.
The Python cryptography package. This package is automatically installed as adependency of python-oracledb. It is strongly recommended that you keep thecryptography package up to date whenever new versions are released. If thecryptography package is not available, you can still install python-oracledbbut can only use it in Thick mode, see Installing python-oracledb without the Cryptography Package.
This will download and install a pre-compiled binary from PyPI if one is available for yourarchitecture. Otherwise, the source will be downloaded, compiled, and theresulting binary installed. Compiling python-oracledb requires thePython.h header file. If you are using the default python package,this file is in the python-devel package or equivalent.
By default, python-oracledb runs in a Thin mode which connects directly toOracle Database so no further installation steps are required. However, to useadditional features available in Thick mode you needOracle Client libraries installed. Oracle Client versions 23, 21, 19, 18, 12and 11.2 are supported.
Oracle Instant Client 23ai will connect to Oracle Database 19 or later.Oracle Instant Client 21c will connect to Oracle Database 12.1 or later.Oracle Instant Client 19c will connect to Oracle Database 11.2 or later.
It is recommended to keep up to date with the latest Oracle Instant Clientrelease updates of your desired major version. Oracle Database 23ai and 19care Long Term Support Releases whereas Oracle Database 21c is an InnovationRelease.
If you use optional Oracle configuration files such as tnsnames.ora,sqlnet.ora, or oraaccess.xml with Instant Client, then put the filesin an accessible directory, for example in/opt/oracle/your_config_dir. Then use:
Alternatively, put the files in the network/admin subdirectory of InstantClient, for example in /opt/oracle/instantclient_21_6/network/admin.This is the default Oracle configuration directory for executables linkedwith this Instant Client.
Alternatively, for version 18 and earlier, every shell runningPython will need to have the environment variableLD_LIBRARY_PATH set to the appropriate directory for theInstant Client version. For example:
If you use optional Oracle configuration files such as tnsnames.ora,sqlnet.ora or oraaccess.xml with Instant Client, then put the filesin an accessible directory, for example in/opt/oracle/your_config_dir. Then your application code can use:
Alternatively, put the files in the network/admin subdirectory of InstantClient, for example in /usr/lib/oracle/21/client64/lib/network/admin.This is the default Oracle configuration directory for executables linkedwith this Instant Client.
The libraries must be either 32-bit or 64-bit, matching your Pythonarchitecture. Note Oracle Database 23ai 32-bit clients are not available on anyplatform, however, you can use older 32-bit clients to connect to OracleDatabase 23ai.
This will download and install a pre-compiled binary if one is available for your architecture. If apre-compiled binary is not available, the source will be downloaded, compiled,and the resulting binary installed.
By default, python-oracledb runs in a Thin mode which connects directly toOracle Database so no further installation steps are required. However, to useadditional features available in Thick mode you needOracle Client libraries installed. Oracle Client versions 21, 19, 18, 12, and11.2 are supported.
If you use optional Oracle configuration files such as tnsnames.ora,sqlnet.ora, or oraaccess.xml with Instant Client, then put the filesin an accessible directory, for example inC:\oracle\your_config_dir. Then use:
Alternatively, put the files in a network\admin subdirectory of InstantClient, for example in C:\oracle\instantclient_19_22\network\admin.This is the default Oracle configuration directory for executables linkedwith this Instant Client.
The Oracle libraries must be either 32-bit or 64-bit, matching your Pythonarchitecture. Note Oracle Database 23ai 32-bit clients are not available onany platform, however, you can use older 32-bit clients to connect to OracleDatabase 23ai.
By default, python-oracledb runs in a Thin mode which connects directly toOracle Database so no further installation steps are required. However, to useadditional features available in Thick mode you needOracle Client libraries installed.
If you use optional Oracle configuration files such as tnsnames.ora,sqlnet.ora, or oraaccess.xml with Oracle Instant Client, then put thefiles in an accessible directory, for example in/Users/your_username/oracle/your_config_dir. Then use:
Alternatively, put the files in the network/admin subdirectory of OracleInstant Client, for example in/Users/your_username/Downloads/instantclient_23_3/network/admin. This is thedefault Oracle configuration directory for executables linked with thisInstant Client.
If the Python cryptography package is not available, python-oracledb can stillbe installed but can only be used in Thick mode. Trying to use Thin mode willgive the error DPY-3016: python-oracledb thin mode cannot be used because thecryptography package is not installed.
Locate your Oracle Database user name and password, and the databaseconnection string. The connection string iscommonly of the format hostname/servicename, using the host name wherethe database is running and the Oracle Database service name of the databaseinstance. For example, localhost/FREEPDB1.
When node-oracledb is used in the default Thin mode, it connects directly tothe Oracle Database and does not require Oracle Client libraries. Connectionsin this mode can be made to Oracle Database 12.1 or later.
Not all features are available in all versions or driver modes. Any attempt touse Oracle features that are not supported by a particular mode or clientlibrary/database combination will result in runtime errors.Thenode-oracledb attributes oracledb.thin, pool.thin andconnection.thin can be used to see what mode a connection is in. In theThick mode, the attribute oracledb.oracleClientVersion can be used todetermine which Oracle Client version is in use. The attributeconnection.oracleServerVersionString can be used to determine whichOracle Database version a connection is accessing. These attributes can beused to adjust application feature usage appropriately.
3a8082e126