Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finding Oracle Homes which Oracle instances are using on Linux | Tanel Poder Consulting #15

Open
utterances-bot opened this issue Jan 26, 2021 · 1 comment

Comments

@utterances-bot
Copy link

Finding Oracle Homes which Oracle instances are using on Linux | Tanel Poder Consulting

I had a question about how to quickly identify which Oracle process runs out of which ORACLE_HOME on Linux.
I have uploaded a little script for that – it’s basically looking up all PMON process IDs and then using /proc/PID/exe link to find out where is the oracle binary of a running process located.
You may have to run this as root (as on some Linux versions I get “ls: cannot read symbolic link: Permission denied” error even when running this command as the owner of all Oracle homes (it seems to happen when your users UID and primary GID are different than thet setuid/setgid bits on the oracle binary): - Linux, Oracle, SQL performance tuning and troubleshooting - consulting & training.

https://tanelpoder.com/2011/02/28/finding-oracle-homes-with/

Copy link

bugnvl commented Jan 26, 2021

pgrep -lf pmon > is not doing good.. so ended up using the below option
[root@abcd agm]# ./finddbhome.sh
PID NAME ORACLE_HOME
60417 ora_pmon_E06P08041 /u01/app/oracle/product/11.2.0.4/dbhome_1/
60425 ora_pmon_E06P08031 /u01/app/oracle/product/11.2.0.4/dbhome_1/
60427 ora_pmon_E06P08021 /u01/app/oracle/product/11.2.0.4/dbhome_1/
60429 ora_pmon_E08P08011 /u01/app/oracle/product/11.2.0.4/dbhome_1/
61098 ora_pmon_E08P08051 /u01/app/oracle/product/12.1.0.2/dbhome_1/
61129 ora_pmon_E06P08071 /u04/app/oracle/product/18c/dbhome_1/
87179 ora_pmon_E08P08031 /u01/app/oracle/product/11.2.0.4/dbhome_1/
86488 ora_pmon_E06P08091 /u04/app/oracle/product/18c/dbhome_1/
[root@abcd agm]# cat finddbhome.sh
#!/bin/bash

little helper script for finding ORACLE_HOMEs for all running instances in a Linux server

by Tanel Poder (http://blog.tanelpoder.com)

printf "%6s %-20s %-80s\n" "PID" "NAME" "ORACLE_HOME"
ps -ef | grep ora_pmon | grep -v grep|awk '{print $2 " " $8}' |
while read pid pname y ; do
printf "%6s %-20s %-80s\n" $pid $pname ls -l /proc/$pid/exe | awk -F'>' '{ print $2 }' | sed 's/bin\/oracle$//' | sort | uniq
done
[root@abcd agm]#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants