If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > I need help with .ksh script to REORCHK and output only Recommended tables to a file.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-14-08, 21:25
pagwu pagwu is offline
Registered User
 
Join Date: Mar 2007
Posts: 70
I need help with .ksh script to REORCHK and output only Recommended tables to a file.

Hi all,
I am comming along with all this Linus/DB2/scripting business...I am no longer scared of it!! (LOL). But,
I need to create a .ksh script that does a REORGCHK and output only tables recommended for reorg.
My goal is to reorgchk and run reorgs based on entries in this reorg file as shown in the example below.
I have tried my hand at the following failing script and hope that gurus here can throw me a lifeline of examples on how
to script this. Here is what I tried to do that is failing: (Actually, I found it someplace):
START SHELL CODE
#!/bin/ksh
DBLIST="EMPLOYEE"

for DB_NAME in $DBLIST
do
db2 connect to $DB_NAME
db2 reorgchk current statistics on table all | grep -v SYSIBM | grep '*' | awk '/^DB2INST1/ && NF == 12 { print " REORG TABLE DB2INST1."$2 ";" }' > ReorgTables.sql
/db2home/db2inst1/sqllib/bin/db2 -tvf ReorgTables.sql &
done
exit 0
END SHELL CODE
Any help will be highly appreciated...

Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On