DB2 database maintenance
You must maintain the TADDM DB2 database regularly to ensure acceptable performance.
The following DB2 utilities are available:
- REORG
- After many changes to table data that are caused by the insertion, deletion, and updating of variable length columns activity, logically sequential data might be on non-sequential physical data pages. Because of that, the database manager performs extra read operations to access data. Reorganize DB2 tables to eliminate fragmentation and reclaim space by using the REORG utility. Use the REORG utility as needed, if RUNSTATS takes longer than typically to complete, or the DB2 REORGCHK command indicates a need for it. Shut down the TADDM server when you run the REORG utility, as during an offline table or index reorganization (data defragmentation), applications can access but not update the data in tables. Since TopologyBuilder runs frequently, even without discovery, such locks might cause unpredictable results within the application.
- RUNSTATS (manual statistics collection)
- The DB2 optimizer uses information and statistics in the DB2 catalog to determine the best access to the database, which is based on the query that is provided. Statistical information is collected for specific tables and indexes in the local database when you run the RUNSTATS utility. When significant numbers of table rows are added or removed, or if data in columns, for which you collect statistics, is updated, the RUNSTATS command must be used to update the statistics. For optimal performance, complete the RUNSTATS task weekly, or daily in situations, where there is high database activity. Lack of updated statistics might cause severe performance degradation within TADDM. You can run the RUNSTATS utility while the TADDM server is running. TADDM requires specific RUNSTATS format that is described later, and DB2 AUTO_RUNSTATS option must be turned off.
- AUTO_RUNSTATS (automatic statistics collection)
- You can enable the automatic statistics collection, also known as auto-runstats, to let DB2 decide whether the TADDM database statistics must be updated. The RUNSTATS utility is run in the background and the database statistics are always up to date.
- DB2 HEALTH MONITOR
- It is good practice to run the DB2 health monitor against the TADDM database to proactively monitor if conditions changed such that RUNSTATS, or REORG, or any other tuning is required. The health monitor can alert a database administrator of potential system health issues. The health monitor proactively detects issues that might lead to hardware failures, or to unacceptable system performance, or capability. Thanks to the proactive health monitoring, you can address an issue before it becomes a problem that affects system performance.
- DB2 PERFORMANCE ANALYSIS SUITE
- When a DB2 problem is suspected, the Performance Analyst tool can quickly analyze a DB2 snapshot that is taken during the time of the problem and suggest actions. You can download this tool at https://www.ibm.com/developerworks/community/groups/community/perfanalyst.
- Before you begin
- After any major maintenance that generates a schema change, for example, after you apply a fix pack, you must generate the TADDM_table_statistics.sql file on the TADDM storage server. The file is needed for the RUNSTATS database maintenance tasks that you must perform regularly. TADDM requires a special format to update database statistics because of a DB2 limitation when handling columns with large common prefixes such as the class names, which are used extensively within TADDM. For this reason, do not use DB2 AUTO_RUNSTATS option, use the RUNSTATS syntax that you generate by completing the following steps. However, if you have DB2 APAR IT05733 installed and the
DB2_SELECTIVITY=DSCC
parameter set, you can use the AUTO_RUNSTATS option.Note: The following instructions are given for the Linux and UNIX operating systems. To perform database maintenance on the Windows operating system, use the corresponding .bat script instead of the .sh script.To generate the TADDM_table_stats.sql file, complete the following steps:- Run the following command:
cd $COLLATION_HOME/bin
- Run the following command, where tmpdir is
a directory, where this file can be created:
./gen_db_stats.jy > tmpdir/TADDM_table_stats.sql
In a streaming server deployment, run this command on the primary storage server.
- Copy the file to the database server, or provide it to your database administrator (DBA) to run against the TADDM database as shown in step 2 in the Procedure. Update database statistics at least weekly, or more often, if there are large changes to any tables.
- Run the following command:
To perform maintenance on a DB2 database, complete the following steps: