Gathering DB2 database statistics daily 

Use the provided script to gather statistics about DB2 database table usage. Run the scripts nightly using the DB2 Task Center, for example, to update internal statistics used by DB2. Up-to-date statistics are necessary for proper performance. This procedure is relevant for DB2 databases only. Oracle and SQL Server gather statistics automatically.

About this task

You can collect statistics while IBM Connections is running and in use. However, it is best to schedule statistic collection to run on a regular basis during off-peak hours using a tool such as DB2 Task Scheduler.

To gather DB2 database statistics...


  1. Copy the statistics script named runstats.sql to the root directory of the application database for which you want to gather statistics. The script is stored in the following subdirectory of the IBM Connections installation files:

    • AIX or Linux™:


    • Microsoft™ Windows™:


      where <application_subdirectory> is the script file storage directory of the application for which you are compacting the database. Choose one of the following subdirectories:

  2. Log into the database server using an ID that has administrative privileges.

  3. Open a command prompt, and then change to the directory to which you copied the script.

  4. Use the following command to run the application scripts:

Parent topic

Maintaining application databases