4 Oracle Database Instant Client Postinstallation Tasks
This chapter describes how to complete postinstallation tasks after you have installed the Oracle Database Instant Client software. It includes information about the following topics:
Oracle recommends that you perform the tasks listed in "Recommended Postinstallation Tasks" after all installations.
If you install and intend to use any of the products listed in "Required Product-Specific Postinstallation Tasks", then you must perform the tasks listed in the product-specific subsections.
4.1 Using Oracle Database Instant Client
instantclient_12_2/sdk/demo.mk
file, then perform the following steps:
- Set the
BUILD64
environment variable toT
. - Edit the
instantclient_12_2/sdk/demo.mk
file and set theCC
andcc
to yourgcc
location. - Compile the C/C++ application using the flags specified in the
demo.mk
file, namely,-idirafter . -DMAC_OSX -D_GNU_SOURCE -D_REENTRANT -g -m64 -mmacosx-version-min=10.11 <c_file_name> -I../include
. - Start
make -f demo.mk buildoci EXE=cdemo81 OBJS=cdemo81.o
for a working demonstration of the options.
The compilation options are as follows:
-idirafter . -DMAC_OSX -D_GNU_SOURCE -D_REENTRANT -g -m64 -mmacosx-version-min=10.11 <c_file_name> -I../include
The link options are as follows:
-g -m64 -mmacosx-version-min=10.11 -rpath full_path_to_instantclient_12_2_libs application_name -L../../ -locci -lclntsh -lpthread
4.2 Recommended Postinstallation Tasks
Oracle recommends that you perform the tasks described in the following sections after completing an installation:
4.2.1 Connecting Instant Client or Instant Client Light to an Oracle Database
Use one of the following methods to specify the database connection information for the instant client application:
-
For OCI and OCCI programs, use the following connection string format:
host[:port][/service_name][:server][/instance_name]
-
Set the
TNS_ADMIN
environment variable to specify the location of thetnsnames.ora
file and specify a service name from that file. -
Set the
TNS_ADMIN
and theTWO_TASK
environment variables to specify a service name from thetnsnames.ora
file.Note:
You do not need to specify theORACLE_HOME
variable.
After checking the environment variable, you can use any of the following methods to specify Oracle Database connection information for client applications:
4.2.1.1 Specifying a Connection by Using the Easy Connect Naming Method
You can specify a connection address to an Oracle Database directly from a client application, without having to configure a tnsnames
setting for the Instant Client. This method is convenient as you do not have to create and manage a tnsnames.ora
file. However, the application users must specify the host name and port number when they want to log in to the application.
For example, if you run SQL*Plus on the client computer and want to connect to the sales_us
database, which is located on a server whose host name is shobeen
and port number is 1521
, then you can log in as follows:
sqlplus system/admin@shobeen:1521/sales_us
Similarly, in the application code, you can use Oracle Call Interface net naming methods to create the Instant Client-to-Oracle Database connection. For example, the following formats in the OCIServerAttach()
call specify the connection information:
-
Specify a SQL connect URL string using one of the following format:
[ ( username, [ "/", password ] | "/" ), [ "@", db_address ] ], [ admin_role ], [ initial_edition ]
or
scott/tiger@inst1
-
Alternatively, you can specify the SQL connect information as an Oracle Net keyword-value pair. For example:
"(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=shobeen) (PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=sales_us)))"
See Also:
Oracle Call Interface Programmer's Guide for more information about using Oracle Call Interface Instant Client
4.2.1.2 Specifying a Connection Using an Empty Connect String and TWO_TASK
You can set the connect string to an empty connect string (""), and then set the TWO_TASK
environment variable to one of the following values:
-
A direct address, as described under "Specifying a Connection by Using the Easy Connect Naming Method"
-
Oracle Net keyword-value pair
-
A
tnsnames.ora
entry andTNS_ADMIN
is set to the location oftnsnames.ora
This method allows the applications to specify internally a connection string if the application code itself uses an empty connection string. The benefit of an empty connect string is that the application itself does not have to specify the tnsnames.ora
entry. Instead, when a user starts the application, the location of the database is determined by a script or the environment, depending on where you have set the TWO_TASK
environment variable. The disadvantage of using empty strings is that you must configure this additional information in order for the application to connect to the database.
4.2.2 Setting the NLS_LANG Environment Variable
NLS_LANG
is an environment variable that specifies the locale behavior for Oracle software. This variable sets the language and territory used by the client application and the database user session. It also declares the character set of the client, which is the character set of data entered or displayed by an Oracle client program, such as SQL*Plus.
Note:
The character set of the data displayed is determined by the environment of the operating system, such as keyboard driver and fonts in use. The NLS_LANG
character set should match the operating system.
Refer to the "Setting Up a Globalization Support Environment" section in Oracle Database Globalization Support Guide for information about Globalization Support.
4.3 Required Product-Specific Postinstallation Tasks
The following sections describe postinstallation tasks that you must perform if you install and intend to use Oracle Precompliers:
Note:
You must perform postinstallation tasks only for products that you intend to use.
4.3.1 Configuring Oracle Precompilers
This section describes postinstallation tasks for Pro*C/C++.
4.3.1.1 Configuring Pro*C/C++
Verify that the PATH
environment variable setting includes the directory that contains the C compiler executable. The default directory for the gcc
compiler executable is /usr/bin
.
See Also:
Pro*C/C++ Programmer's Guide for more information about setting environment variables