Dynamic Environment Switching In Reports

Dynamic Environment Switching In Reports


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


The purpose of this article is to document and demonstrate how Reports 10G can dynamically use different environment variables, without having to have a separate Reports Server for each set of environment variables.

Dynamically Setting Reports 10G Environment Variables.

Previously, when the Reports Server was started it read the registry (Windows) or current environment variables (Unix) and any reports executed via the Reports Server would use these. Therefore, when you wanted to set two different values for an environment variable (eg REPORTS_PATH) and use a specific setting at runtime, this could not be achieved. For example, a developer might want to use one Reports Server but have the REPORTS_PATH pointing to a 'Development Area' and a 'Test Area'. This meant you had to have multiple Reports Server running for each setting, which can be costly in terms of administration. 

However, as from Reports 10G 'Dynamic Environment Switching' has been implemented so you can use one Reports Server, but override certain current settings by using a configuration file.


This article is written for Developers and DBA's alike, or anyone that has an interest in Web Reports.


Environment Variables Set in reports.sh

Note, that if an environment variable is specified in both Dynamic Environment Switching option and also reports.sh, the value set in reports.sh take presedence over the Dynamic Environment Switching. This can lead to problems, and a prime example of this is the REPORTS_PATH. That is since the REPORTS_PATH is reports.sh took presedence, it could lead to a REP-110 : Unable to open file error. NOTE 341800.1 discusses this situation. If you want to add a parameter to Dynamic Environment Switching, first remember removing it from reports.sh.

Dynamic Environment Switching In Reports Versions 11g

In Reports Server version 11g, the Dynamic Environment Switching has to be defined through Enterprise Manager :

Oracle Enterprise Manager 11g Fusion Middleware Control ->Reports Server Homepage -> Reports Server Basic Configuration -> Environment Configuration Section


Dynamic Environment Switching In Reports Versions 9i to 10gR2

For these versions of Report Server, the changes have to be done manually in conf files of the report server.

1. Define The environment Characteristics (Environment Element).

In the Reports Server's configuration file (eg, .conf) which is found in: 
add the following environments.

<environment id="Dev"> 
<envVariable name="REPORTS_PATH" value="d:\MyReports\DevArea"/> 
<environment id="Test"> 
<envVariable name="REPORTS_PATH" value="d:\MyReports\TestArea"/> 

 PLEASE NOTE : The Reports Server needs to be restarted to pick up these changes. If using the in-process reports server. Then either OC4J_BI_FORMS (10g) or WLS_REPORTS (11g) needs to be restarted.


2. Call the reports using the specific Environment Element (ENVID).

So when constructing the URL to call a report you simple add ENVID=.

Example, to run MyTestRep.rdf in the Development area:

&REPORT=MyTestRep.rdf&USERID=<username>/<password>@<connect_string>&DESFORMAT=html &DESTYPE=cache&ENVID=Dev 


Example, to run MyTestRep.rdf in the Test area:

&REPORT=MyTestRep.rdf&USERID=<username>/<password>@<connect_string>&DESFORMAT=html &DESTYPE=cache&ENVID=Test


When invoking reports from Forms Using RUN_REPORT_OBJECT, the ENVID is passed as follows:


Environment variables are not just restricted to the REPORTS_PATH but other variables can also be used.

Ex: NLS_LANG, NLS_CALENDAR. REPORTS_PATH was just used in this article as an example.

Setting defaultEnvID

You are also allowed to set a default environment ID so as not to specify it within the URL. In doing so, the envID specified by the parameter defaultEnvID and in respect it's environment settings is picked up. See Note 292901.1 for further details.

Known Problems

Note 1298701.1 After Applying Patchset, Fusion Middleware Control Inserts "demo:" Tags in Conf Files of Reports Server- ENVID Section Stops Working

Note:1239633.1 Reports Reads Variables from Windows Registry Even Though Dynamic Environment Switching Is Set in 11g

Note:341800.1 Dynamic Environment Switching For REPORTS_PATH Cause REP-110/REP-1070 Errors On Unix/Linux

Note:1078231.1 REP-110 When Running Scheduled Jobs With EnvID, Only After Restarting The Report Server

Note:739271.1 Reports Called via "envid" Hang in Engine, Trace Shows REP-3000 on Unix

Return to Blog