During my development of TVD-Backup I wanted to implement a new subroutine for parsing the output of a srvctl config database command. The first tests on Linux were successful, but the same tests on a Windows system with a German locale failed. After a few minutes of investigation, I found out, that the output of the srvctl was in a different language then expected. In this blog post, I will demonstrate how to change the output language of srvctl.
Server Control Utility (srvctl) can be used to manage or modify resources of a Grid Infrastructure installation, including Oracle Restart and RAC configurations. The tool itself is written in Java ($ORACLE_HOME/srvm/jlib/srvctl.jar), which is called by the platform-dependent wrapper scripts $ORACLE_HOME/bin/srvctl (UNIX / Linux) and %ORACLE_HOME\bin\srvctl.bat (Windows).
Unfortunately srvctl ignores the language part of NLS_LANG. On Windows setting the LANG variable has also no effect.
Normally the LANG variable can be used on UNIX and Linux systems to switch the output language of srvctl. But during my tests, sometimes the variable was ignored – for example on Solaris SPARC in combination with Oracle 12c Release 1 (188.8.131.52).
To get a reliable solution for all platforms and all versions of Oracle Grid Infrastructure / Oracle Database, you can use the environment variable SRVM_PROPERTY_DEFS. Very often the environment variable JRE_OPTIONS can be used to pass special parameters to a Java program. Unfortunately this variable is initalized in the srvctl wrapper scripts and does not consider an already set value for this variable.
Despite SRVM_PROPERTY_DEFS does consider an already set value. Normally this variable is used internally to store tracing options, when tracing was activated through SRVM_TRACE variable.
To set the output language of srvctl, you have to pass the Java option user.language to srvctl.
$> export SRVM_PROPERTY_DEFS="-Duser.language=en" $> srvctl config database -db TESTDB | head -n 1 Database unique name: TESTDB $> export SRVM_PROPERTY_DEFS="-Duser.language=de" $> srvctl config database -db TESTDB | head -n 1 Eindeutiger Datenbankname: TESTDB $> export SRVM_PROPERTY_DEFS="-Duser.language=fr" $> srvctl config database -db TESTDB | head -n 1 Nom de base de données unique : TESTDB
On Windows you have to use the SET command.
$> set SRVM_PROPERTY_DEFS="-Duser.language=de"