Db2
A script to generate sample RUNSTATS and REORG scripts for your Db2® database is provided. The scripts require access to the database catalog and need to be run by a user with appropriate privileges.
The generated scripts are provided as samples, and must be reviewed manually before deployment. These scripts are suitable for testing purposes in a development or test environment rather than a production environment.
The result of running the following script is the generation of .sql files that can be
used to run runstats, reorganize the indexes, and reorganize the tables. After the files
are generated, they need to be reviewed and then can be run at the discretion of your database administrator
(DBA).
- Using a Db2 admin console, go to (install_path)/infrastructure/db/base/maintenance.
- Run the appropriate
script.
generate_runstats_reorg_scripts.cmd [database name] [schema]generate_runstats_reorg_scripts.sh [database name] [schema] [database user] [password] - Review the newly generated .sql files: reorgIndexes.sql, reorgTables.sql, and runstats.sql.