วันจันทร์ที่ 5 ตุลาคม พ.ศ. 2552

How to set the NLS_LANG for the Control Center Service Running on Unix?

  Doc ID: 735185.1 Type: HOWTO
  Modified Date : 02-JUN-2009 Status: MODERATED

In this Document
  Goal
  Solution
  References


This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process, and therefore has not been subject to an independent technical review.

Applies to:

Oracle Warehouse Builder - Version: 10.1 to 11.1
Information in this document applies to any platform.

Goal

How to set the NLS_LANG for tasks that are executed by the Control Center Service (Runtime Service)?

Solution

1. How is the NLS_LANG of the Control Center service determined?

The locale setting (LANG) of your Unix OS affects the NLS_LANG of the session that is spawned by the Control Center to run a Mapping/Process Flow.

See below an example of the value of LOCAL and the resulting NLS_LANG in which the mapping runs.

en_US.UTF8 => AMERICAN_AMERICA.AL32UTF8
de_DE.UTF-8 => GERMAN_GERMANY.AL32UTF8
ja_JP.EUC-JP => JAPANESE_JAPAN.JA16EUC

See Oracle® Database Express Edition Installation Guide for more info on this.


2. How to make the Control Center Service run tasks with a certain NLS_LANG?

Java has the following parameters to set the region and language:

java -Duser.region= -Duser.language=

Add these parameters to the run_service.sh on the Unix server as follows:
  • Stop the runtime service (stop_service.sql)
  • Make a copy of run_service.sh on the server
  • Edit run_service.sh and add the parameters on the location as showed below (french_france used as an example)
$JAVAPATH/bin/java $OPTS -Xmx768M -Duser.region=fr -Duser.language=FR -Djava.awt.headless=true -DORACLE_HOME="${RTHOME}" -DOCM_HOME="${RTHOME}" -DOCM_ORACLE_HOME="${RTHOME}" $CLASSPATH_LAUNCHER oracle.wh.runtime.platform.service.Service ${STARTUP_TYPE} ${NODEID} ${RTUSER} ${HOST} ${PORT} ${SERVICE}
  • Start the runtime service (start_service.sql)
This should make the Control Center Service execute tasks with the NLS_LANG set to french_france.


Alternative solution

On some Unix environments it is also possible to set the OS environment variable LANG in run_service.sh.

e.g.:
LANG=fr_FR.utf8
export LANG

Java will read that variable and the runtime will derive the corresponding NLS_LANG.

Passing of environment variables is controlled by the operating system. Some OS allow the values to be passed through Java and some do not. So this alternative solution might not work on all OS!

Using "-Duser.region= -Duser.language=" as explained above should work on all OS.


3. Common errors that are seen when this LANG has not been set are:


- No data loaded in Targets
- ORA-01843: NOT A VALID MONTH ORA-02063: PRECEDING LINE FROM EX_LINK_MAIN


4. Exceptions

Note that mappings that write to files use the UTL_FILE package. This UTL_FILE package does not use the OS variable LANG, nor uses the parameter "-Duser.region= -Duser.language=" with which the runtime is started.

Using the following in an expression sets the characterset for UTL_FILE:

convert(INGRP1.CN, 'WE8ISO8859P1', 'UTF8')

See following note for more information on this:

Note 227531.1 Character set conversion when using UTL_FILE

References

Note 227531.1 - Character set conversion when using UTL_FILE

0 ความคิดเห็น:

แสดงความคิดเห็น