To enable the DB2 database to optimize queries and find free space,
update the database statistics using the runstats script.
Why and when to perform this task
It is recommended that you update the database statistics regularly,
and especially under any of these circumstances:
- Events have been purged from the database
- A large number of events have been inserted into the database
- Tables have been reorganized using the reorg script
- Indexes have been added or removed from a table
The runstats script is located in the install_root/event/dbscripts/db2
directory.
Steps for this task
To update the database statistics, run the following command:
The parameters are as follows:
- db_alias
- The database alias. The event database must be catalogued on the DB2 client;
if you are running the script on the DB2 server, the database is already catalogued.
- db_user
- The database user ID to use. This parameter is required.
- db_password
- The database password. This parameter is optional. If you do not specify
the password on the command line, the DB2 database will prompt you for it.
Example
For example, the following command updates the
DB2 database statistics on a Windows system where the event database name
is
event, the database user ID is
dbadmin ,
and the password is
mypassword:
runstats.bat event dbadmin mypassword