While databases are becoming more and more self-aware and self-healing, they still require some monitoring to keep them running as efficiently as possible. Just like your car, a database requires some checks to keep it running optimally. This document is broken down into tasks or checks that you can run at different time intervals to ensure that your DB2 databases are running optimally, and detect potential issues before they happen.
The first set of checks or tasks should be run every day to make sure there are no current or imminent problems. The second set should be run weekly to check for issues or problems that may have occurred during the week or are likely to occur in the coming week. The final set of checks or tasks need not be run every day or week, but should be run monthly to keep the system running without problems, and to prevent further issues in the event that a problem does occur.
Monitoring the system
There are a number of reasons that you should monitor your databases, however, the main reason is to ensure that no problems currently exist with the system or are imminent. It is always better to detect a problem and take actions to prevent it from happening than to have to react to a problem once it has happened. By monitoring your DB2 database systems as described in this article, you will be able to detect many problems before they happen, and maintain the performance of your system.
Monitoring tools available
You will typically need to combine DB2 and operating system monitoring in order to get the complete picture of what is happening on the database server. DB2 tools alone normally do not give the complete picture.
When capturing the information for analysis, make sure that the DB2 and operating system information is captured at the same time, as you cannot correlate information captured at different times.
Capturing the system information
When monitoring the system, take the snapshots over a period of time. Taking them for only a one or two minute period will not give a real view of the system activity. I suggest that you take the snapshot every one to 5 minutes, for a period of at least one hour.
Linux and UNIX Tools
For example, to capture the CPU, memory and other operating system usage information on UNIX or Linux we use the tool vmstat. To capture the
The parameters of the vmstat and iostat command are as follows.
Parameter 1 The interval, in seconds, at which the tool captures the system information
Parameter 2 The number of times that the tool should capture the system information
To run vmstat and iostat and capture a snapshot every 5 minutes (300 seconds) for 8 hours (28,800 seconds) you can run the following commands:
vmstat 300 28800 > vmstat.out
iostat -tx 300 28800 > iostat.out
NOTE: the -tx option on iostat is not supported on all UNIX/Linux versions, but is useful since it embeds the timestamp for when the snapshot was taken.
Also make sure to capture the snapshots are normal/average workload times as well as peak workload times. While it is important to ensure the normal workloads are handled efficiently, it is also important to ensure that the system can handle the peak workloads without overloading the server.
On Windows, you can look at the CPU usage and memory usage in the Task Manager as seen below, but you cannot capture this information into a file like you can with vmstat and iostat: