1753913 Members
8935 Online
108810 Solutions
New Discussion юеВ

Oracle 10g sid

 
SOLVED
Go to solution
Sandman!
Honored Contributor

Re: Oracle 10g sid

>#ps -ef|grep ora is there a way to trace this PID to oracle process ID?

Do you mean the Oracle program/process that launched this shadow process. Since the process you are looking at is the Oracle server process aka shadow process which is forked by the Oracle listener process to service an incoming client connection. This will also be the process reported in the SPID column of the v$session table.

~hope it helps
spex
Honored Contributor
Solution

Re: Oracle 10g sid

Hi Tom,

Save the following script to a file, set the execute bit, and pass the OS pid of interest as the first argument:

#!/usr/bin/sh
if [ ${#} -lt 1 ]
then
echo "Usage: $(basename ${0}) "
exit 1
fi
# Set up Oracle environment
. oraenv
UN=myuser
PW=mypass
OSPID=${1}
sqlplus -S "${UN}/${PW}" << _EOF_
SELECT s.sid
FROM v\$session s, v\$process p
WHERE s.paddr = p.addr
AND p.spid=${OSPID};
exit;
_EOF_
exit 0

PCS
tom quach_1
Super Advisor

Re: Oracle 10g sid

Thanks Spex for the script.

this script works, However, i would like to know if these "ps" or "lsof" will work for the same purpose without using sqlplus.

Thanks,
Tom
Sandman!
Honored Contributor

Re: Oracle 10g sid

No lsof or ps won't give the internal Oracle system identifier (SID) associated with each session. That can be obtained only using sqlplus.

~hope it helps
tom quach_1
Super Advisor

Re: Oracle 10g sid

Thank you all for your help.
Spex's script works for my question.

Thanks again
Tom