Tuesday, May 5, 2009

ps (Cpu)

To display top 10 CPU consuming process

$ ps aux | head -1; ps aux | sort -rn +2 | head -10

To display process in order of CPU time

$ ps avx | head -1 ; ps avx | grep -v PID | sort -rn +3 | head -10

This is the total accumulated CPU time for the life of the process and not the clock time.

To display processes in order of being penalized

$ ps -eakl | head -1 ; ps -eakl | sort -rn +5 | head -10

Penalized process are awarded less CPU time. Use nice to increase the priority.

To display processes in order of priority

$ ps -eakl | sort -n +6 | head -10

The lower value in the PRI column has the high priority.

To display processes in order of nice value

$ ps -eakl | head -1; ps -eakl | sort -rn +7 | head -10

By running the above commands you will get the process ids of the top resource consuming sessions. Use the pids in the following SQL statements to get the session details.

SQL> Select * From v$session s, v$process p
Where s.paddr = p.addr
and p.spid in ('pid', ‘pid’);


Thanks

No comments:

Post a Comment

Followers

Powered By Blogger
 

RAC Database Administration. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com