Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • column level grant syntax Oracle
  • How To Limit The Access To The Database So That Only One User Per Schema Are Connected (One Concurrent User Per Schema) Oracle
  • scripts to take listener.log backup Linux/Unix
  • Oracle Connections expire_time and firewall Oracle
  • good note for shared pool tunnig Oracle
  • Kill a session dynanically using execute immediate Oracle
  • lck.sql Oracle
  • Process Map for CPU and Memory for OS processes Linux/Unix
  • segment_wise_space.sql segspace.sql Segment wise space usage (allocated and used) Oracle
  • find_pdbs.sql Uncategorized
  • My FTP Job Scheduling for www.pvmehta.com PHP/MYSQL/Wordpress
  • Global Unique Identifier Generation in Oracle 9.2 SYS_GUID() Oracle
  • rm_backup_arch_file.ksh Linux/Unix
  • On solaris 10, “S” link is not part of $ORACLE_HOME/bin/oracle as default. ( For 9.2.0.8) Oracle
  • How to know Number of CPUs on Sun Box Linux/Unix

Which environment is used by currently running process ( Very good)

Posted on 22-May-2009 By Admin No Comments on Which environment is used by currently running process ( Very good)

Goal

After a process has been started, in order to find out the environment that was used to start it, the following methods can be used, depending on the OS platform:

Solution

1. Determine the pid of the process at OS level, eg for the smon process:

ps -ef | grep smon

2. Get the environment of the process:

SOLARIS:

pargs -e | grep ORACLE

LINUX:

cat /proc//environ

AIX:

ps eauwww

HP-UX:

On this Unix flavor there is no command to grasp the process environment directly. This can only be extracted using a debugger from the _environ structure. This procedure can be used on the other Unix flavors, as follows:

gdb smon
This attaches gdb to the pid mentioned above. The smon name is just an indication that the process we attach to is smon, but the only parameter that matters is the pid.

After attaching to the process, the following command extracts the information from the _environ list:

p ((char**)_environ)[0]@30

which would list the first 30 environment variables. If more are defined, just increase the parameter after @.

As well, the list can be extracted one item from the list at a time, using an iterator like:

p ((char**)_environ)[i]

which would extract element #i+1.

Windows:

To get the information on Windows, 2 things are needed:

1. check the registry for the ORACLE_* keys used to start the Oracle process. These keys are in:

HKEY_LOCAL_MACHINE/Software/Oracle/HOME

(before 10g)

HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE/KEY_

from 10g on.

2. check the environment variables that were used by the oracle process at startup.

For this, one would need the process explorer utility from sysinternals, which can be found at:

www.sysinternals.com

(http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx)

After starting the procexp utility, find the oracle process you want to check in the process list, right click on it, then select Properties. The Environment tab should indicate all the environment variables used when the process was started (even if dynamically in command line).

The utility also displays the key values from registry, but being so many it’s difficult to look for them.

Linux/Unix, shell

Post navigation

Previous Post: Recovering lost SYS password
Next Post: note id 373303.1

Related Posts

  • move_arch_files.ksh /* Good One */ Linux/Unix
  • How to collect CPU usage on Linux using Shell script Linux/Unix
  • secure crt settings Linux/Unix
  • adding new line after specific pattern using sed Linux/Unix
  • Zip and unzip with tar Linux/Unix
  • Oracle GoldenGate lag monitoring shell script Linux/Unix

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Django (0)
  • GIT (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (402)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (18)
  • rman-dataguard (26)
  • shell (150)
  • SQL scripts (350)
  • SQL Server (6)
  • Uncategorized (3)
  • Videos (0)

Recent Posts

  • runon_allpdbs_show_conname.sh23-Apr-2026
  • runon_allcdbs_find_pdbs.sql23-Apr-2026
  • Running PDB on single node in RAC09-Apr-2026
  • find_arc.sql09-Apr-2026
  • pvm_pre_change.sql08-Apr-2026
  • find_encr_wallet.sql08-Apr-2026
  • find_pdbs.sql08-Apr-2026
  • Creating a Container Database using dbaascli08-Apr-2026
  • track_autoupgrade_copy_progress.sql01-Apr-2026
  • refre.sql for multitenant01-Apr-2026

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Export With Query Another Example. Oracle
  • Building Our Own Namespaces with “Create Context” Oracle
  • Find execution plan from dba_hist_sql_plan for a specific SQL_ID and PLAN_HASH_VALUE fplan.sql Oracle
  • V$transaction notes for finding XID composition. Oracle
  • Btee and Bitmap Plans in Oracle 9i and higher Oracle
  • find_du.ksh to find # of files, their sizes in current folder and its subdolder Linux/Unix
  • Another export with Query Oracle
  • ipcs -l Linux/Unix

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme