Where to Set Environment Variables For the Reports Servers in 11g

Where to Set Environment Variables For the Reports Servers in 11g

Where to Set Environment Variables For the Reports Servers in 11g

Titleimage

Posted by Patrick Hamou on 2017:09:26 23:04:09

APPLIES TO: Oracle Reports Developer

Oracle Reports Developer - Version 11.1.1.1.0 to 11.1.2.2.0 [Release 11g]
Information in this document applies to any platform.

GOAL : set environment variables

Where does one set environment variables like TNS_ADMIN, NLS_LANG, REPORTS_PATH and others in an FMW 11g Reports Installation?

 

SOLUTION : Reports Servers: In-Process and Standalone

Lets start by mentioning that Reports 11g (R1orR2) includes by default Two Types of Reports Servers: In-Process and Standalone

more details about them can be found at:

                 Differences and/or Pros and Cons of Using The In-Process Versus Stand-Alone Report Server (Doc ID 274936.1)

Each of these Report Servers have two components, the Server and its Engines. The environment variables are read from different places by the engines or by the server and also depend on the Server type.

Some variables are set with a default value at installation time.

Per example TNS_ADMIN points to ORACLE_INSTANCE\config

A common error you may get if one variable is incorrectly set is the REP-501: "The specified database cannot be connected." Because while you modified one tnsnames.ora your TNS_ADMIN is pointing to another one.

If you want to set custom values then the place to set them will depend of the type of reports server you use:  In-process or  Standalone Reports Server  but also it depends what you use the variable for.
 

Where to Set Environment Variables

 

For the Standalone Reports Servers

  • In a Windows environment  (if the reports server is Not integrated into OPMN) the variables can be set in the $ORACLE_INSTANCE\bin\reports.bat file  or any of the below places following this hierarchy:
    • First environment variables from reports.bat will be usable,
    • Next the environment variable from:           "Control Panel --> System --> Advanced --> Environment Variables" will be effective,
    • When not set on any of the places before, the registry settings will be used.


              ** It is important to note that on windows some variables have length limitations, hence if per example setting REPORTS_PATH you notice your directory is not recognized try changing the order of the pointed directories or reduce the size of the variable

  •   In a Unix environment you can use the reports.sh file under ORACLE_INSTANCE/config/reports/bin

 

For one particular standalone reports server integrated into opmn.

     Set the variable to your custom value in the opmn.xml in the instance home ( remember to stop all processes first using $ORACLE_INSTANCE/bin/opmnctl stopall)

     Here it is a sample section from opmn.xml

.....
<environment>
<variable id="PATH" value="D:\Oracle\Middleware\..."/>
<variable id="TNS_ADMIN" value="D:\Oracle\TNS_ADMIN"/>
<variable id='REPORTS_PATH" value "D:\Oracle\MyAPP\Reports"/>
</environment>

It is important that after changing/setting the variables in opmn.xml you restart the Report Servers and reload  opmn :
$ORACLE_INSTANCE/bin/opmnctl startall
$ORACLE_INSTANCE/bin/opmnctl reload

* Also for one particular Reports Server you can use: the Dynamic Environment Switching feature. this is a little more complex approach which will not be discussed here but can find information in the included reference at the end of this note.

For the In-process Reports Server 

    The In-Process Reports Server, the Server Component, does not read variables from the reports.sh or reports.bat as the standalone does, it does take the values from the Domain Variables in $DOMAIN_HOME/bin/setDomainEnv.sh file. 

Here it is a sample section from setDomainEnv.sh

...
set LD_LIBRARY_PATH=D:\MW114\FR_BIN\lib;%LD_LIBRARY_PATH%
set PATH=D:\MW114\FR_BIN\bin;%PATH%
set TNS_ADMIN=D:\MW114\Instances\FRInst\config

However it is important to clarify that the engine component does read from these files (reports.sh or reports.bat).

So if the parameter is related to engine (like NLS_LANG or TNS_ADMIN for a job ), the parameters set in the reports.sh or reports.bat file will be effective but if the parameter is related to the server component (for example TNS_ADMIN for "jobStatusRepository", or CLASSPATH for a pluggable destination) then the value is taken from the setDomainEnv.sh


Once you have customized your environment you could use any of the follow URLs to verify the values your set are the correct ones used by the Reports Server.  The second one used if you have a secured (SSO) reports server. 

http://host:port/reports/rwservlet/showenv?server=your_repserver_name
or
http://host:port/reports/rwservlet/showenv?server=your_repserver_name&authid=orcladmin/pswd


For any Reports Server  being used with FORMS if you need variables available to Forms

  • Include your value(s) in the beginning of any existing VARIABLE entry of the default.env or add variable and value at the end. i.e  If the REPORTS_PATH entry does not exist, create it at the end of the file. Be aware that default.env will be read by the Forms runtime (frmweb ...), but not from Reports Server / Reports engine

 

Return to Blog