Online Tutorials & Training Materials |
Register Login

What Environment settings are required for R/3/Oracle on Windows?

|| 0

What Environment settings are required for R/3/Oracle on Windows?

When you connect R/3 work processes, R3trans, tp or saplicense to Oracle on NT or Windows 2000, one of the following errors occurs:

*** ERROR => DlLoadLib: LoadLibrary
            <drive> :usrsap<sid>sysexerundboraslib.dll,
            Error: 126 [dlnt.c       180]
*** ERROR => Couldn't load library
            '<drive> :usrsap<sid>sysexerundboraslib.dll'
            [dbcon.c      3564]
Error 126 = "The specified module could not be found."
2EETW169 no connect possible:
connect failed with DBLI_RC_LOAD_LIB_FAILED.
ERROR: environment variable dbms_type is not set.
*** ERROR => Invalid profile or undefined profile parameter dbms/type
            (or environment variable dbms_type) = <undef>,
              cannot load DB library
*** ERROR => Cannot connect: TNS-name missing
*** ERROR => Cannot connect: tnsname is missing
*** ERROR => OCI-call 'olog' failed: rc = 12154
*** ERROR => OCI-call 'OCIServerAttach' failed: rc = 12154
*** ERROR => CONNECT failed with sql error '12154'
*** ERROR => OCI-call 'olog' failed: rc = 1017
*** ERROR => OCI-call 'OCISessionBegin' failed: rc = 1017
*** ERROR => CONNECT failed with sql error '1017'
*** ERROR => OCI-call 'olog' failed: rc = 1019
*** ERROR => CONNECT failed with sql error '1019'
*** ERROR => OCI-call 'OCIInitialize' failed: rc = -1
*** ERROR => OCI-call 'OCIErrorGet' failed: rc = -2
*** ERROR => OCI-call 'olog' failed: rc = 12705
*** ERROR => OCI-call 'OCISessionBegin' failed: rc = 12705
*** ERROR => CONNECT failed with sql error '12705'
*** ERROR => NLS_LANG not set in environment
*** ERROR => NLS_LANG not set appropriately (DB installation requires
            AMERICAN_AMERICA.<characterset>) ==> connection refused
***LOG BZA=> table SVERS      does not exist on database
*** ERROR => tskh_init: db_connect (step 1, th_errno 13,
*** ERROR => ThrSaveSPAFields: no valid thr_wpadm
*** ERROR => ThCallHooks: event handler ThrSaveSPAFields
            for event BEFORE_DUMP failed [thxxtool3.c  226]
***LOG BZY=>unexpected return code 103        calling NTAB
***LOG BZY=>unexpected return code 103        calling DbSlExeRd

Errors similar to the following occur when you use sapdba, brbackup, brarchive or brconnect from R/3 (using transaction DB13, for example) or when you display the logs for these tools (using transaction DB12 or DB14, for example):

BR152E Environment variable SAPDATA_HOME is not set
BR152E Environment variable ORACLE_SID is not set
unable to read operating system log '<file>'
SAPDBA: ORACLE_HOME='<oracle_home_env>' of environment must not be set
        or must be set according to registry value
        '<oracle_home_reg>' in 'softwareoraclehome<n>' and PATH ...
BR252E Function fopen() failed for '<file>' at location main-4
BR253E errno 2: No such file or directory
BR121E Processing log file <file> failed
SAPDBA: Invalid directory '<directory>'!
        Please set environment variable.

The following error may occur when you start SQLPLUS:

SP2-0642: SQL*Plus internal error state 2165

The following syslog and work process trace entries may occur if NLS_LANG is not set or is set incorrectly:

BB7 W Sort sequence error loading table
***LOG BB7=> loading bad sorted table

Returncode from check_sort : 102

The placeholder <sid> stands for the three-digit R/3 SID below.

Certain environment variables are required to set up a connection to the database:

    1. The database-dependent name of the library is determined dynamically using dbms_type:

  • dbms_type = ora: dboraslib.dll -> Oracle
  • dbms_type = inf: dbinfslib.dll -> Informix
  • dbms_type = mss: dbmssslib.dll -> MS SQL Server
  •  ...

    2. The DLL dboraslib.dll loads additional libraries from %ORACLE_HOME%bin. Therefore, this directory must be contained in the PATH.

    3. If dboraslib.dll could be loaded correctly, a Net8 connection to the database is opened (based on dbs_ora_tnsname).

    4. A logon to the database now occurs with the user defined in dbs_ora_schema (or SAPR3, if this variable is not set).

    5. If the logon is successful, the system checks to see whether NLS_LANG from the environment corresponds to the database character set actually used.

To enable sapdba or the BR tools to function successfully from R/3, you require the following additional environment variables:

  • You must set SAPDATA_HOME on the directory under which the standard sapdata directories appear.
  • You must set ORACLE_SID.
  • With a difference for SAPDATA_HOME, you must also set SAPBACKUP, SAPARCH , SAPREORG, SAPCHECK, SAPTRACE and/or SAPDATA[number].
  • USER must be set to <sid>adm to ensure that an RSH call of SAPXPG and the BR*TOOLS on the database server that is initiated from the gateway is always started under the correct user <sid>adm ("-l <sid>adm" is generated in the call).

Make sure that the following variables are set in the environment of the failed process:

  • COMSPEC=<path_to_cmd.exe>
  • dbms_type=ora
  • PATH=<oracle_home>bin;... (<oracle_home>bin in first position)
  • dbs_ora_tnsname=<sid>
  • dbs_ora_schema=SAPR3 or dbs_ora_schema=SAP<sid> (depending on which user the R/3 tables belong to)
  • NLS_LANG=AMERICAN_AMERICA.<characterset> (see Note 381674)
  • ORACLE_HOME=<oracle_home> (optional)
  • SAPDATA_HOME=<drive>:oracle<sid>
  • TNS_ADMIN=<pfad_zu_tns_files> (only required for R/3 below 3.1I or Oracle 10g and Instant Client)
  • ORACLE_SID=<sid> (normal Oracle installation) or unique instance name, for example <sid>001 (RAC installation)
  • USER=<sid>adm


When you use several Oracle databases on a server, note that variables such as ORACLE_HOME or "PATH=<oracle_home>bin..." must not be set in the SYSTEM environment. Instead, they must be set locally in each case in the environment of the database users.

You should NOT set the following variables in the environment:

  • ORA_NLS33
  • auth_shadow_upgrade
  • TNS_ADMIN (except with R/3 3.1I or lower or Oracle 10g)

You must only set the following variables if the corresponding locations are different to SAPDATA_HOME:

  • SAPDATA[number]

For more information, see Note 94801. These variables must never be set on an incorrect disk drive.

When you are adjusting the environment, it is important to understand that R/3 does not necessarily run on Windows in the environment of the <sid>adm user. We must therefore distinguish between the following two scenarios:

  •     The termination occurs when you call a tool such as R3trans or sapdba directly on Windows

           In this case, you can determine the current environment by executing the SET command in the DOS box. This environment comprises the global system environment and the user-specific environment.


-> Settings
-> Control Panel
-> System
-> Advanced
-> Environment Settings

           Use this to determine the current settings for the system environment and the user environment. You can change these settings here. It makes sense to set the variables required for the Oracle connection in the user environment, particularly if there are several Oracle installations on the host.

           Note that changes only become active in the system environment after you restart Windows.

  •     The termination occurs when you start the SAP instance or when you call a tool from R/3 (for example, from transaction DB13)

           The SAP instance is started under the user entered as the start user for the SAP service, therefore usually SAPSERVICE<sid>. The SAP environment used, however, is NOT the environment of SAPSERVICE<sid>. Instead, the entries in the Registry under the following path are used:

HKEY_LOCAL_MACHINE -> Software -> SAP -> <sid> -> Environment

           . These entries can be:

        entered manually or

        copied from the current environment using ntenv2reg or

        by defining an AdmUser entry under

        HKEY_LOCAL_MACHINE -> Software -> SAP -> <sid>

                    they can be automatically reconciled with the environment of the defined user each time R/3 is started.

           For more detailed information, see Note 31559.

           If the error still occurs the next time you restart SAP, check to see whether the registry entries were unintentionally changed during start-up. If so, there are still problems with the AdmUser entry. There have been instances in the past where, for example, the AdmUser was set to a domain user while the correct settings existed in the environment of a local user of the same name. If you do not want to use the automatic environment comparison, you can delete the AdmUser entry.