Monday 5 August 2019

How To Check Environment Variables for a Running Process

This post we will talking about one of the useful things which administrator often has to use. The topic is How To Check Environment Variables for a Running Process . Let’s first start with what is environment variable and then find out How To Check Environment Variables for a Running Process in different flavor of Unix systtem

What is environment Variable
An environment variable is a dynamic-named value that can affect the way running processes will behave on a computer.
They are part of the environment in which a process runs. For example, a running process can query the value of the TEMP environment variable to discover a suitable location to store temporary files, or the HOME or USERPROFILE variable to find the directory structure owned by the user running the process.
Unix
environment variable as accessed as $VARIABLE
Windows
environment variable as accessed as %VARIABLE%
Many times  we need to find out what environment variable were set when the process was  started. One use case would be finding out environment variable for the oracle database instance started from Oracle cluster ware.
You may want to know what TNS_ADMIN variable ,oracle instance process are using. If it is not set ,it will be using default location $ORACLE_HOME/network/admin.  We can find the environment variable using the below command on various flavor of Unix  system.You just need to use the command on pmon process -id of the database instance to get the information
How To Check Environment Variables for a Running Process ?
In Linux,
strings –a /proc/<pid_of_the_process>/environ
or
ps eww <pid>

In Solaris,
pargs -e <pid_of_the_process>
In AIX,
pargs or ps eww <pid_of_the_process>
The above command will help us in troubleshooting various issues

0 comments:

Post a Comment