#reorg table
db2 -x "select ‘reorg table ‘||rtrim(tabschema)||‘.‘||tabname||‘;‘ from syscat.tables where TYPE=‘T‘" > reorg.sql
#reorg index
db2 -x "select ‘reorg indexes all for table ‘||rtrim(tabschema)||‘.‘||tabname||‘;‘ from syscat.tables where TYPE=‘T‘" > reorg_index.sql
#runstats table
db2 -x "select ‘runstats on table ‘||rtrim(tabschema)||‘.‘||tabname|| ‘ and indexes all;‘ from syscat.tables where tabschema=‘NRWAUSR‘ and TYPE=‘T‘" > runstats.sql
# rebind
db2 -x "select ‘rebind package ‘||rtrim(pkgschema)||‘.‘||pkgname||‘;‘ from syscat.packages where pkgschema not in (‘NULLID‘ ) and PKGSCHEMA=‘NRWAUSR‘" > rebind.sql
db2 -tvf reorg.sql -z reorg_error.log
db2 -tvf reorg_index.sql -z reorg_index.log
db2 -tvf runstats.sql -z runstats_error.log
db2 -tvf rebind.sql -z rebind_error.log