I recently had a co-worker access one of my systems running Oracle Database 11g. He needed to poke around with focus on an area that he specialized in. After getting him access to the server I got an email from him asking where the trace files are for the instance he was investigating.
This is one of those Carry On Wayward Googler™ sort of posts. Most of you will know this, but it may help someone someday. It did help my co-worker as this was the way I answered his question.
You can find out a lot about an instance without even knowing which ORACLE_HOME it is executing out of by spelunking about in /proc. In the following text box you’ll see how to find the ORACLE_HOME and trace directories for an instance by looking at /proc/<PID>/fd and /proc/<PID>/exe of the LGWR process. This box had an instance called test and an ASM instance. So in this case the ORACLE_HOME values were /u01/app/oracle/product/11.2.0/dbhome_1 and /u01/app/11.2.0/grid.
$ ps -ef | grep lgwr | grep -v grep oracle 3548 1 0 Sep02 ? 00:00:27 ora_lgwr_test3 oracle 8734 1 0 Sep02 ? 00:00:00 asm_lgwr_+ASM3 $ $ ls -l /proc/8734/exe /proc/3548/exe lrwxrwxrwx 1 oracle oinstall 0 Sep 2 21:09 /proc/3548/exe -> /u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle lrwxrwxrwx 1 oracle oinstall 0 Sep 2 11:09 /proc/8734/exe -> /u01/app/11.2.0/grid/bin/oracle $ $ ls -l /proc/8734/fd /proc/3548/fd | grep trace | grep -v grep l-wx------ 1 oracle oinstall 64 Sep 2 21:09 11 -> /u01/app/oracle/diag/rdbms/test/test3/trace/test3_ora_3501.trc l-wx------ 1 oracle oinstall 64 Sep 2 21:09 12 -> /u01/app/oracle/diag/rdbms/test/test3/trace/test3_ora_3501.trm l-wx------ 1 oracle oinstall 64 Sep 2 11:09 16 -> /u01/app/oracle/diag/asm/+asm/+ASM3/trace/+ASM3_ora_8636.trc l-wx------ 1 oracle oinstall 64 Sep 2 11:09 17 -> /u01/app/oracle/diag/asm/+asm/+ASM3/trace/+ASM3_ora_8636.trm
Yeah, linux proc filesystem is especially nice as lots of files there are readable and dont need special programs for parsing their binary contents (as opposed to solaris /proc for example)
I’ve used pmap on linux and other Unixes for same purposes, such identifying which processes use which oracle homes etc.
Thanks Kevin.. I was looking for this since long time :)) pmap option from Tanel also looks interesting approach for other flavors of Unix ..
Cheers
Amit
dont forget about lsof, as well.