General Performance
vmstat
$ vmstat 5 3
Displays system statistics (5 seconds apart; 3 times):
procs | memory | page | disk | faults | cpu | ||||||||||||||||
r | b | w | swap | free | re | mf | pi | po | fr | de | sr | s0 | s1 | s2 | s3 | in | sy | cs | us | sy | id |
0 | 0 | 0 | 28872 | 8792 | 8 | 5 | 172 | 142 | 210 | 0 | 24 | 3 | 11 | 17 | 2 | 289 | 1081 | 201 | 14 | 6 | 80 |
0 | 0 | 0 | 102920 | 1936 | 1 | 95 | 193 | 6 | 302 | 1264 | 235 | 12 | 1 | 0 | 3 | 240 | 459 | 211 | 0 | 2 | 97 |
0 | 0 | 0 | 102800 | 1960 | 0 | 0 | 0 | 0 | 0 | 464 | 0 | 0 | 0 | 0 | 0 | 107 | 146 | 29 | 0 | 0 | 100 |
Having any processes in the b or w columns is a sign of a problem system.
Having an id of 0 is a sign that the cpu is overburdoned.
Having high values in pi and po show excessive paging.
- procs (Reports the number of processes in each of the following states)
- r : in run queue
- b : blocked for resources (I/O, paging etc.)
- w : runnable but swapped
- memory (Reports on usage of virtual and real memory)
- swap : swap space currently available (Kbytes)
- free : size of free list (Kbytes)
- page (Reports information about page faults and paging activity (units per second)
- re : page reclaims
- mf : minor faults
- pi : Kbytes paged in
- po : Kbytes paged out
- fr : Kbytes freed
- de : anticipated short-term memory shortfall (Kbytes)
- sr : pages scanned by clock algorith
- disk (Reports the number of disk operations per second for up to 4 disks
- faults (Reports the trap/interupt rates (per second)
- in : (non clock) device interupts
- si : system calls
- cs : CPU context switches
- cpu (Reports the breakdown of percentage usage of CPU time (averaged across all CPUs)
- us : user time
- si : system time
- cs : idle time
CPU Usage
sar
$ sar -u 10 8
Reports CPU Utilization (10 seconds apart; 8 times):
Time | %usr | %sys | %wio | %idle |
11:57:31 | 72 | 28 | 0 | 0 |
11:57:41 | 70 | 30 | 0 | 0 |
11:57:51 | 70 | 30 | 0 | 0 |
11:58:01 | 68 | 32 | 0 | 0 |
11:58:11 | 67 | 33 | 0 | 0 |
11:58:21 | 65 | 28 | 0 | 7 |
11:58:31 | 73 | 27 | 0 | 0 |
11:58:41 | 69 | 31 | 0 | 0 |
Average | 69 | 30 | 0 | 1 |
%usr: Percent of CPU in user mode
%sys: Percent of CPU in system mode
%wio: Percent of CPU running idle with a process waiting for block I/O
%idle: Percent of CPU that is idle
mpstat
$ mpstat 10 2
Reports per-processor statistics on Sun Solaris (10 seconds apart; 8 times):
CPU | minf | mjf | xcal | intr | ithr | csw | icsw | migr | smtx | srw | syscl | usr | sys | wt | idl |
0 | 6 | 8 | 0 | 438 | 237 | 246 | 85 | 0 | 0 | 21 | 8542 | 23 | 9 | 9 | 59 |
0 | 0 | 29 | 0 | 744 | 544 | 494 | 206 | 0 | 0 | 95 | 110911 | 65 | 29 | 6 | 0 |
ps
$ ps -e -o pcpu -o pid -o user -o args | sort -k 1 | tail -21rDisplays the top 20 CPU users on the system.
%CPU | PID | USER | COMMAND |
78.1 | 4789 | oracle | ora_dbwr_DDDS2 |
8.5 | 4793 | oracle | ora_lgwr_DDDS2 |
2.4 | 6206 | oracle | oracleDDDS2 (LOCAL=NO) |
0.1 | 4797 | oracle | ora_smon_DDDS2 |
0.1 | 6207 | oracle | oracleDDDS2 (LOCAL=NO) |
etc. | etc. | etc. | etc. |
The PID column can then be matched with the SPID column on the V$PROCESS view to provide more information on the process:
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';
Error Lines in Files
You can return the error lines in a file using:
root> cat alert_LIN1.log | grep -i ORA-
The "grep -i ORA-" command limits the output to lines containing "ORA-". The "-i" flag makes the comparison case insensitive. A count of the error lines can be returned using the "wc" command. This normally give a word count, but the "-l" flag alteres it to give a line count:
root> cat alert_LIN1.log | grep -i ORA- | wc -l
Remove DOS CR/LFs (^M)
Remove DOS style CR/LF characters (^M) from UNIX files using:
The newly created tempfile should have the ^M character removed.sed -e 's/^M$//' filename > tempfile
from : http://www.oracle-base.com/articles/misc/UNIXForDBAs.php