Write the following scripts in a .out file, then execute it by issuing the db2 command with option -tvf.
- Reorg for all tables
$db2 -x "select 'reorg table',substr(rtrim(tabschema)||'.'||rtrim(tabname),1,50),';'from syscat.tables where type = 'T' " > reorg.out
$db2 -tvf reorg.out
- Reorgchk for all tables
syscat.tables where type = 'T' " > reorgchk.out
$db2 -tvf reorgchk.out
- Runstats for all tables
syscat.tables where type = 'T' " > runstats.out
$db2 -tvf runstats.out
Executing reorg, reorgcheck and runstats for all tables from one specific tablespace.
- Reorg for all tables from one specifc tablespace
from syscat.tables where type = 'T' and tbspace='<tablespace_name>'" > reorg.out
$db2 -tvf reorg.out
- Reorgchk for all tables from one specifc tablespace
syscat.tables where type = 'T' and tbspace='<tablespace_name>'" > reorgchk.out
$db2 -tvf reorgchk.ou
- Runstats for all tables from one specifc tablespace
syscat.tables where type = 'T' " > runstas.out
$db2 -tvf runstats.out
I am getting the below error when I try to run the - Reorgchk for all tables from one specifc tablespace
ReplyDelete>>> db2 -tvf reorgchk.out
DB21007E End of file reached while reading the command.
Contents of file (reorgchk.out) is as below,
db2 -x "select 'reorgchk update statistics on table',substr(rtrim(tabschema)||'.'||rtrim(tabname),1,50),';' from \
syscat.tables where type = 'T' and tbspace='P2A#ZOMK1D'" > reorgchk.out
Can you please help me on this ?