View the value of the environment variable used by an Oracle process. When nls_lang is null, we want to know the default value. When installing the version, we want to know that a process is generated by the database of that version, we can use the following method to view the environment variable value of the ORACLE process.
Because different operating systems use different commands, only the commands under the solaris platform are tested here, and only the methods are written on other platforms.
Environment: solaris 10, oracle 11gr2
1. view the process ID.
- $ ps -ef|grep ora
- oracle 4530 1 0 20:07:12 ? 0:00 ora_reco_htzdg
- oracle 4548 1 0 20:07:18 ? 0:02 ora_arc0_htzdg
- oracle 4575 1 0 20:07:22 ? 0:04 ora_cjq0_htzdg
- oracle 12667 1 0 22:05:34 ? 0:00 ora_w002_htzdg
2. view the process environment variables:
- $ pargs -e 12667
- 12667: ora_w002_htzdg
- envp[0]: SKGP_SPAWN_DIAG_PRE_EXEC_TS=
- envp[1]: SKGP_HIDDEN_ARGS=
- envp[2]: SKGP_SPAWN_DIAG_POST_FORK_TS=
- envp[3]: SKGP_SPAWN_DIAG_PRE_FORK_TS=
- envp[4]: ORACLE_SPAWNED_PROCESS=1
- envp[5]: XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt
- envp[6]: DISPLAY=192.168.100.1:0.0
- envp[7]: ORACLE_BASE=/u01/app/oracle
- envp[8]: PWD=/u01/app/oracle/product/11.2.0/db_2/bin
- envp[9]: _=./dbua
- envp[10]: SHELL_HOME=/home/oracle/rs
- envp[11]: ORACLE_SID=htzdg
- envp[12]: NLSPATH=/usr/dt/lib/nls/msg/%L/%N.cat
- envp[13]: MAIL=/usr/mail/oracle
- envp[14]: TZ=PRC
- envp[15]: NLS_LANG=AMERICAN_AMERICA.AL32UTF8
- envp[16]: JAVA64FLAG=-d64
- envp[17]: HOME=/home/oracle
- envp[18]: LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/db_2/lib:/u01/app/oracle/product/11.2.0/db_2/jdk/jre/lib/amd64/server:/u01/app/oracle/product/11.2.0/db_2/jdk/jre/lib/amd64:/u01/app/oracle/product/11.2.0/db_2/jdk/jre/../lib/amd64:/u01/app/oracle/product/11.2.0/db_2/lib:/u01/app/oracle/product/11.2.0/db_2/network/lib:
- envp[19]: TERM=vt100
- envp[20]: SHELL=/bin/ksh
- envp[21]: LOGNAME=oracle
- envp[22]: PATH=
- envp[23]: ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_2
- envp[24]: ORA_NET2_DESC=10,13
The default NLS_LANG and other values that use the default environment variables appear.
3. Other platforms
LINUX: cat/proc/<pid from above>/environ
AIX: ps eauwww <pid from above>