2010-10-07

how to change the language of database error messages

Purpose of this document : To explain how to change the language of the Oracle RDBMS error messages.


What are the message files, where are they and how are they used?

Oracle picks up the error message text from the *.msb files in the "$ORACLE_HOME/..../mesg" directory's.
The *.msg files (not available in all distributions) are the clear text files of the msb and are as such not called/used by the Oracle software stack.
For example the file for the standard ora- errors is ora<language ID>.msb and located in $ORACLE_HOME/rdbms/mesg.
In the $ORACLE_HOME/plsql/mesg directory the files who contain messages related to plsql are found, etc.

The only exception are the Oracle Work Bench message files found under $ORACLE_HOME/owb there text translations are found in different subdirectory's.

There is for each language a different ID, for example "English" (=American English) is  *us.msb (or *us.msg), French is *f.msb (or *f.msg).
"English" is always installed by default, the Universal installed installs typically "English" and the language of the OS locale during installation.

For an installation on a Windows system where the OS is set to Turkish the *us.msb and *tr.msb file will be installed by default.

During installation it's possible to add more or remove language used for the message files using the "product languages" button in one of the first installer screens (depends on version).
For 10g and 11g this can be done when choosing "Advanced installation" in the first screen, in the next screen there is a "product languages" button.

On a system where during installation Dutch and Polish where selected as "product languages" one will find in the $ORACLE_HOME/rdbms/mesg 3 languages for the "core" ora- messages: oraus.msb, oranl.msb and orapl.msb .

Note that not all messages are translated in all languages.
For example the csscan tool has only English messages and you will find only, even when other languages are selected during installation, a cscus.msb in $ORACLE_HOME/csmig/mesg.
The same is true for Oradim or ASMtool ( oradimus.msb / oraasmtoolus.msb) found in $ORACLE_HOME/rdbms/mesg.
A list of in what languages the error messages are translated and the used abbreviation is found in the documentation set ( Oracle Database Globalization Support Guide Appendix A Locale Data.).
For 11.2 this is (Name Abbreviation) ARABIC ar, BRAZILIAN PORTUGUESE ptb, CATALAN ca, CZECH cs, DANISH dk, DUTCH nl, FINNISH sf, FRENCH f,GERMAN d, GREEK el, HEBREW iw, HUNGARIAN hu, ITALIAN i, JAPANESE ja, KOREAN ko, NORWEGIAN n, POLISH pl, PORTUGUESE pt, ROMANIAN ro, RUSSIAN ru, SIMPLIFIED CHINESE zhs, SLOVAK sk, SPANISH e, SWEDISH s, THAI th,TRADITIONAL CHINESE zht, TURKISH tr .

The language file USED is chosen depending on the session's NLS_LANGUAGE (NLS_SESSION_PARAMETERS).
This is defined by the client side NLS_LANGUAGE parameter, if this is not explicitly set on the client side then the NLS_LANGUAGE part of the client's NLS_LANG environment variable is used.
Note:241047.1 The Priority of NLS Parameters Explained.

So in order to have "Polish" messages there are 5 conditions that need to be met:
* the client OS needs to be able to display "Polish" characters (= client characterset configuration).
* the server should also be able to process "Polish" characters (NLS_CHARACTERSET config) for serverside errors.
* the sessions NLS_LANGUAGE (or NLS_LANGUAGE part of NLS_LANG) needs to be set to "POLISH".
* the Polish .msb files need to be installed on the server for serverside POLISH messages.
* the Polish .msb files need to be installed on the client for clientside POLISH messages.

If the session's NLS_LANGUAGE is set to POLISH but the *pl.msb  files are not installed then the default, *us.msb file is used and the error will be in English.

The language of entry's in the alert.log is depending on if the actual user session is writing the error or if a background process is doing this.
Background processes use the NLS_LANGUAGE found in NLS_INSTANCE_PARAMETERS, this can be changed in the pfile/spfile.

Seen session use settings defined on the client side it is still possible that some entry's in the alert.log are in English. This then simply means that this client did use "American" or an other NLS_LANGUAGE value for which the message files are not installed (and so the default, English, is used).

I don't want any other language than English for the messages.

The solution is to only install the *us.msb ("English") files on ALL clients and servers.
This can be done at installation time by deselecting all other languages or to change on the installation media in the \install\oraparm.ini file the NLS_ENABLED=TRUE parameter to NLS_ENABLED=FALSE.
With this set to FALSE only US (English) files will be installed and (on windows) the NLS_LANG added to the registry will also default to AMERICAN_AMERICA instead of the <Language>_<territory> who match the LOCALE of the windows installation.

For an existing system one can

* de-install the software and the re-install it choosing the required "Product languages"
note that it's currently not possible to "remove" languages using the Universal installer without de-installation and re-installation.
OR
* remove all the non *us.msb (and *us.msg if they exist) files but be carefull to not remove accidentially *us.msb files and do not delete the *.msg file under $ORACLE_HOME/owb
OR
* install the same Oracle version and platform (!!!) on an other system / Oracle_home making sure only "English" is installed
* delete in the current home all *.msg and *.msb files
* copy all *.msg and *.msb files from the new installation to the same location in the original home.

I want my system to give all messages in an other language than English.

If they are not installed then you need to install the msb/msg files for that language at installation time using the "product languages" button in the Universal installer.

For an existing installation who have not the needed *.msb/*msg files installed one can

* In 10.2 and higher, use the new -addLangs option in the Oracle Universal Installer to add new language message support:
See the documentation set : http://st-doc.us.oracle.com/10/102/em.102/b16227/oui9_internalization.htm#CACGEDHD
OR
* de-install the software and the re-install it choosing the required "Product languages"
note that it's not possible to "add" languages using the Universal installer without de-installation and re-installation in versions lower that 10.2.
OR
* install the same Oracle version and platform (!!!) on an other system / Oracle_home making sure the required langauage is installed
* copy all *.msg and *.msb files from the new installation to the same location in the original home.

Once the files are in place you then need to make sure that
* NLS_LANGUAGE is set in the init.ora (NLS_INSTANCE_PARAMETERS)
* all clients need to use as that language as NLS_LANGUAGE (NLS_SESSION_PARAMETERS)
Note:241047.1 The Priority of NLS Parameters Explained.

Seen session use settings defined on the client side it is still possible that some entry's in the alert.log are in English. This then simply means that this client did use "American" or an other NLS_LANGUAGE value for which the message files are not installed (and so the default, English, is used).

Niciun comentariu:

Trimiteți un comentariu