UNIX commands used to gather system resource information:
Here I am sharing some of my memorable moments with Unix. You can get some idea of unix commands for gathering system resource detail. Some UNIX OS commands can be used to collect Operating system related information to understand whether the overuse of OS resources can be affecting the database performance on the database server. These resources include physical memory, swap space, CPU usage, etc. The following examples are for Solaris.
1. how much physical memory the server has
$ /usr/sbin/prtconf | grep -i “Memory size”
Memory size: 16384 Megabytes
- the usage of swap space
$ swap -s
total: 6342024k bytes allocated + 1364480k reserved = 7706504k used, 15856256k available
- get free space in each mount point and swap space information
$ df -h
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d5 197G 138G 57G 72% /u01
/dev/md/dsk/d110 19G 15G 4.3G 78% /
swap 15G 1.4M 15G 1% /etc/svc/volatile
swap 15G 2.5M 15G 1% /tmp
swap 15G 40K 15G 1% /var/run
/dev/md/dsk/d40 67G 11G 56G 17% /u04
- get the overall information using top command: top command provides information about physical memory, swap usage, top CPU consuming processes, CPU usage in the system.
$ /usr/local/bin/top
load averages: 1.23, 0.95, 0.74; up 24+07:30:27 14:30:56
257 processes: 254 sleeping, 3 on cpu
CPU states: 40.2% idle, 42.3% user, 17.6% kernel, 0.0% iowait, 0.0% swap
Memory: 16G phys mem, 6960M free mem, 15G swap, 14G free swap
PID USERNAME LWP PRI NICE SIZE RES STATE TIME CPU COMMAND
11874 oracle 1 40 0 898M 780M cpu 0:17 88.76% oracle
1921 oracle 1 60 0 811M 688M sleep 35:57 67.99% oracle
12340 bb 1 50 0 3640K 2104K cpu 0:00 4.53% top
12194 oracle 1 59 0 4672K 2640K cpu 0:00 3.30% top
12223 bb 1 40 0 1696K 1288K sleep 0:00 2.78% bb-local.sh
1 root 1 59 0 2904K 1336K sleep 7:00 1.72% init
8178 oracle 15 53 2 790M 454M sleep 3:11 1.18% oracle
18812 oracle 1 53 2 883M 322M sleep 3:29 0.57% oracle
12222 bb 1 59 0 1672K 1264K sleep 0:00 0.49% sh
8120 oracle 11 53 2 547M 331M sleep 3:40 0.46% oracle
5363 oracle 11 53 2 780M 475M sleep 3:54 0.46% oracle
29648 oracle 1 59 0 1026M 525M sleep 4:22 0.42% oracle
8176 oracle 235 53 2 785M 460M sleep 2:06 0.37% oracle
8145 oracle 16 53 2 1030M 871M sleep 1:39 0.19% oracle
1475 oracle 1 59 0 426M 364M sleep 18:28 0.19% oracle
- vmstat provides information about process run queue, memory usage, paging and swaping and CPU usage in the server. Different options in vmstat can provide more specific information.
$ vmstat 5 5
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr m5 m2 m2 m2 in sy cs us sy id
0 0 0 10554280 7353280 639 223 2987 4 5 0 2 3 0 0 0 827 5819 1234 14 3 82
0 0 0 15728832 7427848 84 963 24 3 3 0 0 0 0 0 0 598 11859 433 96 4 0
0 0 0 15723816 7423000 1 110 6 0 0 0 0 0 0 0 0 666 10357 473 98 2 0
0 0 0 15713512 7414560 49 285 219 0 0 0 0 0 0 0 0 739 9104 590 96 4 0
1 0 0 15710064 7411080 2 85 2 0 0 0 0 0 0 0 0 729 9255 530 98 2 0
- iostat provides IO usage by disk, CPU usage, etc. information depending on options used.
$ iostat -D 2 5
md5 md20 md21 md22
rps wps util rps wps util rps wps util rps wps util
2 1 1.0 0 0 0.0 0 0 0.0 0 0 0.0
0 0 0.0 0 0 0.0 0 0 0.0 0 0 0.0
0 0 0.0 0 0 0.0 0 0 0.0 0 0 0.0
0 0 0.0 0 0 0.0 0 0 0.0 0 0 0.0
0 0 0.0 0 0 0.0 0 0 0.0 0 0 0.0
$ iostat -c 2 5
cpu
us sy wt id
14 3 0 82
98 2 0 0
95 5 0 0
98 2 0 0
98 2 0 0
- mpstat provides CPU usage statistics with 1 or more CPUs. It is very useful for multi-processor system to provide details about the CPU usage by every CPU in the server.
$ mpstat 2 2
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
0 83 6 42 63 14 272 19 29 11 8 1515 14 3 0 83
1 38 5 47 233 205 186 18 21 15 7 1321 13 2 0 84
2 24 6 38 110 85 200 20 17 14 7 1556 18 2 0 80
3 77 10 63 421 145 575 29 32 18 10 1428 13 4 0 83
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
0 0 0 29 116 13 125 64 30 8 0 5280 96 4 0 0
1 0 0 42 98 52 60 36 8 2 0 814 99 1 0 0
2 154 0 156 88 26 88 49 5 4 0 4838 98 2 0 0
3 0 0 80 330 46 218 106 26 4 0 1143 98 2 0 0
Of course, you can learn more from my some old articles like Identification of Unix Shell and Oracle on Windows vs Unix and Linux – Differences. Expert remote DBA support team of Dbametrix provides Oracle support for all kinds of operating system like SCO, Linux, Unix, Win2k, etc. Get connected with our Expert DBA Team Club blog for getting more database technology articles and tips.
When you want to make a strong Oracle DBA career then you should be aware of database services and other database technology. Without having knowledge of Oracle internals, Oracle performance tuning, and skill of Oracle database troubleshooting you can’t be an Oracle DBA expert.
This expert DBA Team club blog always provides you latest technology news and database news to keep yourself up to date. You should need to be aware of Cloud database technology like DBaaS. All Oracle DBA tips are available in a single unique resource at our orageek. Meanwhile, we are also providing some sql tutorials for Oracle DBA. This is the part of Dbametrix Group and you would enjoy more advanced topics from our partner resource.