这个脚本很不错,导出数据时,只是加上表名就行了,其实import或load数据可以参考同样的方式:
#!/usr/bin/sh
db2 connect to web
list="
DB2INST1.ACCESS_ID
DB2INST1.ACCESS_ID_HIST
DB2INST1.APPL_PRIV_CODE_RULE_BLUE_GROUP
DB2INST1.CUST_RFC_BATCH_ERR
DB2INST1.CUST_DTRMNTN_LOOKUP_HIST
DB2INST1.NOTIFIED_USER
DB2INST1.NOTIFIED_USER_HIST
DB2INST1.SAMETIME_USERS
DB2INST1.SAP_IDOC_USER_ID_XREF
DB2INST1.SAP_IDOC_USER_ID_XREF_HIST
DB2INST1.USER_PRIV
DB2INST1.USER_PRIV_HIST
DB2INST1.USERS
DB2INST1.USERS_HIST
DB2INST1.WEB_AUTH_REG
"
for one in $list
do
db2 -v "export to $one.ixf of ixf select * from $one with ur" >>export.log
if [ $? -ne 0 ]; then
echo "error table: $one">>error.log
fi
done