In this post, we will talk about one of the useful things that administrator often has to use. The topic is How To Get environment variables of running process Linux. Let’s first start with what is environment variable and then find out How To Check Environment Variables for a Running Process in different flavours of Unix system
What is the 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 variables were set when the process was started. One use case would be finding out environment variables for the Oracle database instance started from Oracle Clusterware.
You may want to know what TNS_ADMIN variable and Oracle instance process are using. If it is not set, it will be using the default location $ORACLE_HOME/network/admin. We can find the environment variable using the below command on various flavours of the Unix systems.You just need to use the command on pmon process -id of the database instance to get the information
How To get environment variables of running process Linux?
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. Hope you like this post on how to get environment variables of running process Linux,Solaris and AIX
Related Articles
Oracle ASM Interview Questions
query to get concurrent program run details in oracle apps
Oracle interview questions : Check out this page for Top 49 Oracle Interview questions and answers : Basics , Oracle SQL to help you in interviews.Additional material is also provided
Unix command for Oracle DBA : This page has useful Unix command for Oracle DBA to help you in your day-to-day activites.Same are applicable for linux also.How to kill the process
how to copy directory in linux : Check out this post the detailed description on how to copy file/directory in linux. Examples of copy directory linux command is also given
https://docs.oracle.com/cd/E57185_01/EPMIS/ch05s03s02s03.html