SETENV

Valid For

Extract and Replicat.

Any SETENV values should be set before any USERIDALIAS, FETCHUSERIDALIAS, TRANLOGOPTIONS MININGUSER, MININGUSERIDALIAS entries in the parameter files.

Description

Use the SETENV parameter to set a value for an environment variable. When Extract or Replicat starts, it uses the specified value instead of the one that is set in the operating system environment. A variable set in the SETENV statement overrides any existing variables set at the operating system level. Use one SETENV statement per variable to be set.

For integrated extracts, you can set new environment variables if they are available from the lcr server. The new environment variables are:
  • USERNAME: Database login user name
  • OSUSERNAME: Operating System user name

  • MACHINENAME: Name of the host, machine, or server where the database is running

  • PROGRAMNAME: Name of program or application that started the transaction or session

  • CLIENTIDENTIFIER: Value set using DBMS_SESSION.set_identifier()

SETENV cannot be used with query parameters.

Default

None

Syntax

SETENV (
{environment_variable | TZ}
= 'value'
)
environment_variable

The name of the environment variable to be set.

TZ

(MySQL only) When running Oracle GoldenGate for MySQL on a Windows server or on a Linux server which is on a remote host from the database server, use the SETENV parameter within the Extract parameter file to set the timezone to match the one in the database server. The following is the supported format of time zone values for the TZ option:

SETENV(TZ='tzn [+|-]hh[:mm[:ss]][dzn]')

tzn - Three-letter time-zone name, such as PST. You must specify the correct offset from local time to UTC.
hh - Difference in hours between UTC and local time. Sign (+) optional for positive values.
mm - Minutes. Separated from hh by a colon (:).
ss - Seconds. Separated from mm by a colon (:).
dzn - Three-letter daylight-saving-time zone such as PDT. 
If daylight saving time is never in effect in the locality, set TZ without a value for dzn. The C run-time 
library assumes the United States' rules for implementing the calculation of daylight saving time (DST).

The offset is positive if the local time zone is west of the Prime Meridian and negative if it is East. The hour must be between 0 and 24, and the minute and seconds between 0 and 59.

'value'

A value for the specified variable. Enclose the value within single quotes.

Examples

Example 1

Using separate SETENV statements allows a single instance of Oracle GoldenGate to connect to multiple Oracle database instances without having to change environment settings. The following parameter statements set a value for ORACLE_HOME and ORACLE_SID.

SETENV (ORACLE_HOME = '/home/oracle/ora9/product')
SETENV (ORACLE_SID = 'ora9')
Example 2

The following parameter statement sets the time zone of a Oracle GoldenGate for MySQL Extract to Pacific Standard Time, UTC or IST with automatic DST switching.

SETENV(TZ='PST8PDT')
For UTC, SETENV(TZ='UTC')
For IST, SETENV(TZ='IST-05:30')