onstat -g env command: Print environment variable values

Use the onstat -g env command to display the values of the environment variables that the database server currently uses.

Figure 1: Syntax:

1  onstat   -g env
2.1 all
2.1 variable
2.1  sessionid? variable
You can specify one of the following invocations.
Invocation Explanation
onstat -g env Displays the settings of environment variables when the database server was started

Does not display environment variables that have not been set explicitly.

onstat -g env all Displays the settings used by all sessions

This display is the same as the output of onstat -g env and onstat -g envsessionid iteratively on all current sessions.

onstat -g env variable Displays the default value of the specified environment variable

This variable argument eliminates the need to pipe the output to grep (or some other utility) to locate an environment variable among many that might be set.

onstat -g env sessionid Displays the settings that a specific session uses. This display includes the following values:
  • Set in the environment of the session
  • Assigned by the database server, as onstat -g env displays
onstat -g env sessionid variable Displays the value of the specified environment variable that the specified session uses

The sessionid and variable arguments eliminate the need to pipe the output to grep (or some other utility) to locate an environment variable among many that might be set.

The onstat -g env command displays the current setting of an environment variable and the complete list of values each time the variable was set in the environment. For example, if PDQPRIORITY is set to 10 in the .onedb.rc file and set to 55 in the shell environment, onstat -g env command displays both values.

However, if you change the PDQPRIORITY with the onmode -q pdqpriority sessionid command, the onstat -g env command does not display the new value for the session. The onstat -g env command displays only the values of environment variables set in the environment. It does not display values modified while the session is running.

You might want to display the values of environment variables in the following situations:
  • The database server instance has been up for months, and you cannot remember the setting of an environment variable (such as the server locale setting SERVER_LOCALE).
  • You want to display the complete list of values for an environment variable to identify when an environment variable has been set in multiple places.
  • Environment files on disk might have changed or been lost in the interim.
  • A support engineer wants to know settings of specific environment variables.

Example output

The following figure shows the output for the onstat -g env command.
Figure 2: onstat -g env command output

Variable            Value [values-list]
DBDATE              DMY4/
DBDELIMITER         |
DBPATH              .
DBPRINT             lp -s
DBTEMP              /tmp
ONEDB_HOME         /build2/11.50/tristarm/sqldist
                    [/build2/11.50/tristarm/sqldist]
                    [/usr/informix]
ONEDB_SERVER      parata1150
ONEDB_ TERM        termcap
LANG                C
LC_COLLATE          C
LC_CTYPE            C
LC_MONETARY         C
LC_NUMERIC          C
LC_TIME             C
LD_LIBRARY_PATH     /usr/openwin/lib:/lib:/usr/lib
LKNOTIFY            yes
LOCKDOWN            no
NODEFDAC            no
NON_M6_ATTRS_OK     1
PATH                /build2/11.50/tristarm/sqldist/bin:.:
                    /root/bin:/opt/SUNWspro/bin:/usr/ccs/bin:
                    /usr/openwin/bin:/usr/sbin:/usr/bin:/usr
                    /local/bin
SERVER_LOCALE       en_US.819
SHELL               /bin/ksh
SINGLELEVEL         no
SUBQCACHESZ         10
TBCONFIG            onconfig
TERM                xterm
                    [xterm]
                    [dumb]
TERMCAP             /etc/termcap
TZ                  GB