Quantcast
Channel: Oracle Bloggers
Viewing all articles
Browse latest Browse all 19780

attaching to foreground process with strace in sh script

$
0
0

Apparently, it is not only the Oracle employees who use strace on foreground to process to get some info.

 

Locks, Latches, Mutexes and CPU usage | The Pythian Blog

To find out how it is implemented, I have traced Oracle foreground processes.

Last week, I had to do same in shell script for trouble shooting. Here are the lines.
I think one can do same with dtrace or debugger.

#!/bin/bash
( sleep 3
  ora_fg_pid=$(pgrep -P $(pgrep -P $$ sqlplus))
  lsof -p $ora_fg_pid > /tmp/$ora_fg_pid.strace
  echo -e "\n= = = =strace begings here= = = =\n">> /tmp/$ora_fg_pid.strace
  strace -fp $ora_fg_pid >> /tmp/$ora_fg_pid.strace 2>&1 ) &
sqlplus -S scott/tiger <<EOF
--Wait for strace to attach.
execute user_lock.sleep(500)
--Do real stuff.
select * from dual
/
EOF




Viewing all articles
Browse latest Browse all 19780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>