Pidstat

Recently, I’ve been faced with a strange problem: around 10AM every morning, my database was showing signs of IO contention. Wait times for db file sequential and multipblock reads were increasing for no apparent reason and there were no signs of increased activity reported by the users. Fortunately, my system is running RH 6.x which has things like iostat. There is one particularly useful utility called “pidstat”. It allows me to select only oracle processes and report IO, CPU or switching activity. It’s a part of the systat package, the same package which contains sar, vmstat and iostat:

[root@medo mgogala]# rpm -qf /usr/bin/pidstat
sysstat-10.0.3-2.fc17.x86_64

The use is very simple. To report on disk usage by the oracle processes,  the following can be used:

[root@medo mgogala]# pidstat -d -C oracle
Linux 3.8.4-102.fc17.x86_64 (medo.home.com)     04/02/2013     _x86_64_    (4 CPU)

10:54:47 AM       PID   kB_rd/s   kB_wr/s kB_ccwr/s  Command
10:54:47 AM      2910      0.02      0.00      0.00  oracle
10:54:47 AM      2914      0.00      0.00      0.00  oracle
10:54:47 AM      2918      0.00      0.00      0.00  oracle
10:54:47 AM      2920      0.00      0.00      0.00  oracle
10:54:47 AM      2922      0.00      0.00      0.00  oracle
10:54:47 AM      2924      0.01      0.00      0.00  oracle
10:54:47 AM      2926      0.00      0.00      0.00  oracle
10:54:47 AM      2928      0.01      0.00      0.00  oracle
10:54:47 AM      2930      0.02      0.06      0.00  oracle
10:54:47 AM      2932      0.04      0.04      0.00  oracle
10:54:47 AM      2934      0.07      0.00      0.00  oracle
10:54:47 AM      2936      0.00      0.00      0.00  oracle
10:54:47 AM      2938      0.27      0.00      0.00  oracle
10:54:47 AM      2942      0.01      0.00      0.00  oracle
10:54:47 AM      2944      0.01      0.00      0.00  oracle
10:54:47 AM      2951      0.04      0.09      0.00  oracle
10:54:47 AM      2954      0.00      0.00      0.00  oracle
10:54:47 AM      2956      0.02      0.00      0.00  oracle
10:54:47 AM      2958      0.01      0.00      0.00  oracle
10:54:47 AM      2960      0.00      0.00      0.00  oracle
10:54:47 AM      4215      0.10      0.00      0.00  oracle
10:54:47 AM      4217      0.00      0.00      0.00  oracle
10:54:47 AM      4219      0.02      0.00      0.00  oracle
10:54:47 AM      4221      0.03      0.00      0.00  oracle
10:54:47 AM      4223      0.00      0.00      0.00  oracle

For the CPU usage, one would use “-u” instead of “-d”.

About these ads

About mgogala

I am a long time Oracle DBA, who has worked on very large databases. I have worked with OPS and RAC since its inception.I am also a published book writer, having published two books about PHP. This blog is about the challenges and adventures in my professional life. Sorry, no family pictures here.
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s