Here is a handy trick to dynamically generate RUNSTATS STMTS using the SQL CONCAT and STRIP functions.
Run this SQL in SPUFI, cut and paste the generated output for subsequent processing by DSNUTILB.
-- THIS SQL STATEMENT WILL DYNAMICALLY GENERATE -- RUNSTATS STATEMENTS -- FOR ALL TABLESPACES MATCHING THE SEARCH CRITERIA ------------------------------------------------------------------------ SELECT DISTINCT 'RUNSTATS TABLESPACE ' CONCAT STRIP(DBNAME,TRAILING) CONCAT '.' CONCAT NAME CONCAT ' TABLE ALL INDEX ALL UPDATE ALL' FROM SYSIBM.SYSTABLESPACE WHERE DBNAME = 'DSQDBCTL' ;
For More Information
- The Best DB2 Web Links: tips, tutorials, scripts, and more.
- Have a DB2 tip to offer your fellow DBA's? The best tips submitted will receive a cool prize--submit your tip today!
- Ask your technical DB2 questions--or help out your peers by answering them--in our live discussion forums.
- Check out our Ask the Experts feature: Our DB2 gurus are waiting to answer your toughest questions.
This was first published in December 2001