Running Db2 maintenance manually

This section describes how to perform the Db2 maintenance process on demand, instead of waiting for the database to do it according to its automatic maintenance policy, if any. The process is run by the dbrunstats script which you can run whenever you need to, without stopping the database, or interrupting its processing.

The script is available in inst_dir/dbtools/db2/scripts.

To run this script, follow this procedure:
  1. Copy the db2 folder to the database server. This folder contains the scripts and the related .sql files.
  2. Check that the user who is going to run the procedure has the appropriate rights:
    • Database administrator permissions
    • Full access to and control of the HCL Workload Automation or Dynamic Workload Console installation directory
  3. On the database server, open a database shell.
  4. From within the shell, browse to the directory where you copied the script.
  5. Run the script:
    UNIX
    dbrunstats.sh database [user [password]]
    Windows
    dbrunstats.sh database [user [password]]
    where:
    database
    The name of the database. The default name is TWS.
    user
    The database administration user. If this is omitted, the ID of the user running the command is used.
    password
    The password of the will administration user. If this is omitted, it is requested interactively.

    The script runs, giving you various messages denoting its progress and successful conclusion. At the end, the database performance parameters have been reset to maximize performance.