How to set DB2 Governor Config File
To create a governor configuration file:
In a directory that is mounted or available from all database
manager partitions, create an ASCII file with a descriptive name.
For example, the configuration file for a governor instance
that monitors the sales database might be
called govcfgsales.
1 - Open the file in any text editor and enter configuration information and action conditions.
2 - End each rule with a semicolon (;). The following configuration information is recommended:
-
dbname: The name or alias of the database to be monitored.
- account: The number of minutes after which the governor instance
writes CPU usage statistics to its log file. This option is not
available on Windows NT.
- interval: The number of seconds after which the governor daemon
wakes up to monitor activity. If you do not specify an interval,
the default value of 120 seconds is used.
For example, the first three rules in the configuration file might look like this:
{ Wake up once a second, the database name is employee,
do accounting every 20 minutes. }
interval 1; dbname employee; account 20;
3 - Add rules that specify the conditions to monitor and the action to take if the rule evaluates to true. For example, you might add a rule that limits to an hour the amount of time that a unit of work (UOW) can run before being forced to disconnect from the database, as follows:
4 - Save the file
To start the governor:
db2gov [START | STOP] <db_name> [DBPARTITIONNUM <dbpart_number>] <cfg_file> <log_file>
Example:
db2gov start sample dbpartitionnum 0 fileX.cfg fileX.log
Below, some examples how to set DB2 config file
The action nice,is just avaiable on DB2 9.1 fix pack 5
{ Wake up once a second, the database name is ibmsampl,
do accounting every 30 minutes. }
interval 1; dbname ibmsampl; account 30;
desc "CPU restrictions apply 24 hours a day to everyone"
setlimit cpu 600 rowssel 1000000 rowsread 5000000;
desc "Allow no UOW to run for more than an hour"
setlimit uowtime 3600 action force;
desc 'Slow down a subset of applications'
applname jointA, jointB, jointC, quryA
setlimit cpu 3 locks 1000 rowssel 500 rowsread 5000;
desc "Have governor prioritize these 6 long apps in 1 class"
applname longq1, longq2, longq3, longq4, longq5, longq6
setlimit cpu -1
action schedule class;
desc "Schedule all applications run by the planning dept"
authid planid1, planid2, planid3, planid4, planid5
setlimit cpu -1
action schedule;
desc "Schedule all CPU hogs in one class which will control consumption"
setlimit cpu 3600
action schedule class;
desc "Slow down the use of db2 CLP by the novice user"
authid novice
applname db2bp.exe
setlimit cpu 5 locks 100 rowssel 250;
desc "During day hours do not let anyone run for more than 10 seconds"
time 8:30 17:00 setlimit cpu 10 action force;
desc "Allow users doing performance tuning to run some of
their applications during lunch hour"
time 12:00 13:00 authid ming, geoffrey, john, bill
applname tpcc1, tpcc2, tpcA, tpvG setlimit cpu 600 rowssel 120000 action force;
desc "Some people should not be limited -- database administrator
and a few others. As this is the last specification in the
file, it will override what came before."
authid gene, hershel, janet setlimit cpu -1 locks -1 rowssel -1 uowtime -1;
desc "Just avaiable start DB2 9.1 fix pack 5"
desc "Increase the priority of an important application so it always
completes quickly"
applname V1app setlimit cpu 1 locks 1 rowssel 1 action nice 20;