Using the ps command you can find the processes that are consuming much CPU time on Unix and Linux machines.
$ ps -e -o pcpu -o pid -o user -o args | sort -k 1 | tail -21r
This command will display the top 20 CPU users on the system and below is the output of this command:
%CPU PID USER COMMAND 
65.1 4789 oracle ora_dbwr_TESTDB
8.5 4793 oracle ora_lgwr_TESTDB 
2.4 6206 oracle oracleTESTDB (LOCAL=NO) 
0.1 4797 oracle ora_smon_TESTDB 
0.1 6207 oracle oracleTESTDB (LOCAL=NO) 
The PID column from the ps output you can match it with the SPID column on the V$PROCESS dictionary view to provide more information on the process by this query:
SELECT   A.USERNAME,
         A.OSUSER,
         A.PROGRAM,
         SPID,
         SID,
         A.SERIAL#
  FROM   V$SESSION A, V$PROCESS B
 WHERE   A.PADDR = B.ADDR AND SPID = '&pid';
No comments:
Post a Comment