Site icon Database Tutorials

Script To Gather Statistics On Table and Indexes On DB2

 

RUNSTATS utility perform statistics in DB2. Should be perform Weekly or Monthly basis.

Following Script helps to gather statistics on all tables excluding XML columns and there associated indexes . Output will be emailed.

First, it will generate the RUNSTATS command-line output into [/dbawork/runstats.out], then same output file will be executed with command-line db2 -tvf 

Script can be modified as per your need.

Script tested on created on AIX 7.1 (Bash) DB2 V 10.5.

Required Input

Provide schema name in query

Define email Id’s to mailgroup.

Exit mobile version