需要帮助w / .ksh脚本到REORCHK&输出推荐表到文件 [英] Need help w/.ksh script to REORCHK & output Recommended tables to a file
问题描述
大家好,
我和所有这些Linus / DB2 /脚本业务一起来......我不是
更害怕它! (大声笑)。但是,
我需要创建一个.ksh脚本来执行REORGCHK并仅输出表格
建议用于重组。
我的目标是reorgchk并根据此reorg文件中的条目运行reorgs,如下例所示。
我已尝试过以下失败的脚本并希望这里的大师
可以给我一个关于如何编写脚本的例子的生命线。这是我试图做的事情就是失败:(实际上,我发现它在某个地方):
START SHELL CODE
#!/ bin / ksh
DBLIST =EMPLOYEE
$ DBLIST中DB_NAME的
do
db2连接到$ DB_NAME
db2 reorgchk当前统计数据表所有| grep -v SYSIBM | grep''*''|
awk''/ ^ DB2INST1 /&& NF == 12 {print" REORG TABLE DB2INST1。$ 2;" }''>
ReorgTables.sql
/ db2home / db2inst1 / sqllib / bin / db2 -tvf ReorgTables.sql&
done
退出0
结束外壳代码
任何帮助都将受到高度赞赏...
谢谢
-
通过DBMonster.com发布消息
http://www.dbmonster.com/Uwe/Forums....m-db2/200806/ 1
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
--
Message posted via DBMonster.com
http://www.dbmonster.com/Uwe/Forums....m-db2/200806/1
推荐答案
DBLIST
do
db2 connect到
DBLIST
do
db2 connect to
DB_NAME
db2 reorgchk当前统计数据表所有| grep -v SYSIBM | grep''*''|
awk''/ ^ DB2INST1 /&& NF == 12 {print" REORG TABLE DB2INST1。"
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
退出0
结束外壳代码
任何帮助都将受到高度赞赏...
谢谢
-
通过DBMonster.com发布消息
http://www.dbmonster.com/Uwe/Forums....m-db2/200806/ 1
2 ";" }'' >
ReorgTables.sql
/db2home/db2inst1/sqllib/bin/db2 -tvf ReorgTables.sql &
done
exit 0
END SHELL CODE
Any help will be highly appreciated...
Thanks
--
Message posted via DBMonster.com
http://www.dbmonster.com/Uwe/Forums....m-db2/200806/1
这篇关于需要帮助w / .ksh脚本到REORCHK&输出推荐表到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!