Almost every flavor of the UNIX operating system has a version of the iostat utility. The purpose of iostat is to provide
an elapsed time measure of the amount of physical I/O addressed to the disk devices. This elapsed time measure is a log showing the number of times that the physical drive is accessed. To run the iostat utility, enter the following command:
%> iostat 5
The “iostat 5” says to display one line of output for every disk attached to our database server. In this case we get 37 lines of output every 5 seconds, each showing the amount of I/O for each disk.
View the code belwo to see the entire output.
This diagram below gives a detailed overview of the output headers.
% tm_act, The percentage of time that the disk was physically active.
Kbps, The number of kilobytes transferred per second.
Tps, The number of I/O requests to the disk. Note that multiple logical I/O requests may be merged into a single physical request.
Kb_read, The number of kilobytes read during the interval.
Kb_wrtn, The number of kilobytes written during the time interval.
Capturing Data with Shell Script
You can write a shell script to capture this iostat data and place it into Oracle tables. Click the MouseOver button to see such a script. Once the data is stored inside an Oracle table, you can run queries against the table to get historical I/O information.
Set the sample time to 300 (5 minutes = 300 seconds).
Run iostat and pipe the output into the /tmp directory.
Gather the current date from UNIX.
Print the output from /tmp and for each line, insert a row into an Oracle table called iostat.
Disk Array Package
Note:
If you are using a disk array package with a memory cache (such as EMC), the physical I/O statistics may be misleading. This is because some I/O may be fetched from the disk memory cache and did not result in a real disk I/O. The next lesson describes more about hot disks.