Reorganizing the Db2 database

About this task

Using this script, Db2 physically reorganizes the data tables and indexes, optimizing disk space usage and ease of data access. The process is time-consuming, requires that the database is backed up, and that HCL Workload Automation is stopped. However, at the end you have a database that is completely reorganized.

To reorganize the database, follow this procedure:
  1. Copy the db2 folder to the database server. This folder contains the scripts and the related .sql files.
  2. Stop WebSphere Application Server Liberty and appservman by running the following command:
    conman "stopappserver;wait"
    See Starting and stopping the application server and appservman for full details.
  3. Back up the HCL Workload Automation database. Follow the instructions in the Db2 documentation, as appropriate.
  4. 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
  5. On the database server where you copied the script, open a command shell.
  6. From within the shell, browse to the directory where you copied the script.
  7. Run the script:
    UNIX
    dbreorg.sh database [user [password]]
    Windows
    dbreorg 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 database administration user. If this is omitted, it is requested interactively.

    The script runs, giving you various messages denoting its progress and successful conclusion.

  8. Restart WebSphere Application Server Liberty and appservman by running the following command:
    conman "startappserver;wait"
    See Starting and stopping the application server and appservman for full details.