#!/bin/ksh
#######################################################################
# 程序名称: unload.sh
# 程序功能: PICC流程控制系统数据库卸载工具
# 编写日期: 2014/07
# 备 注:
#######################################################################
. ~/.profile
date=`date +%Y%m%d`
prpdb=flowctrldb@liucheng
LPLCEXPDIR=$PWD/LPLCEXP
if [ -d $LPLCEXPDIR ]
then
echo "the directry 'LPLCEXP' is exist!"
rm -r $LPLCEXPDIR/*
else
mkdir $LPLCEXPDIR
fi
mkdir $LPLCEXPDIR/log $LPLCEXPDIR/unl
echo "start prplfl4smain: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
echo "正在导出prplfl4smain表:"`date "+%Y-%m-%d %H:%M:%S"`
dbaccess $prpdb <<!
set isolation to dirty read;
unload to $LPLCEXPDIR/unl/prplfl4smain.unl select * from prplfl4smain where company like '13%';
!
echo "end prplfl4smain: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
compress -f $LPLCEXPDIR/unl/prplfl4smain.unl
echo "prplfl4smain表导出完成:"`date "+%Y-%m-%d %H:%M:%S"`
echo "start prpdcompany: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
echo "正在导出prpdcompany表:"`date "+%Y-%m-%d %H:%M:%S"`
dbaccess $prpdb <<!
set isolation to dirty read;
unload to $LPLCEXPDIR/unl/prpdcompany.unl select * from prpdcompany where comcode like '13%';
!
echo "end prpdcompany: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
compress -f $LPLCEXPDIR/unl/prpdcompany.unl
echo "prpdcompany表导出完成:"`date "+%Y-%m-%d %H:%M:%S"`
echo "start prplflidddictionary: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
echo "正在导出prplflidddictionary表:"`date "+%Y-%m-%d %H:%M:%S"`
dbaccess $prpdb <<!
set isolation to dirty read;
unload to $LPLCEXPDIR/unl/prplflidddictionary.unl select * from prplflidddictionary;
!
echo "end prplflidddictionary: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
compress -f $LPLCEXPDIR/unl/prplflidddictionary.unl
echo "prplflidddictionary表导出完成:"`date "+%Y-%m-%d %H:%M:%S"`
echo "start prplfldcode: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
echo "正在导出prplfldcode表:"`date "+%Y-%m-%d %H:%M:%S"`
dbaccess $prpdb <<!
set isolation to dirty read;
unload to $LPLCEXPDIR/unl/prplfldcode.unl select * from prplfldcode;
!
echo "end prplfldcode: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
compress -f $LPLCEXPDIR/unl/prplfldcode.unl
echo "prplfldcode表导出完成:"`date "+%Y-%m-%d %H:%M:%S"`
echo "start prplfl4srepaircount: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
echo "正在导出prplfl4srepaircount表:"`date "+%Y-%m-%d %H:%M:%S"`
dbaccess $prpdb <<!
set isolation to dirty read;
unload to $LPLCEXPDIR/unl/prplfl4srepaircount.unl select * from prplfl4srepaircount where agentcode like '13%';
!
echo "end prplfl4srepaircount: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
compress -f $LPLCEXPDIR/unl/prplfl4srepaircount.unl
echo "prplfl4srepaircount表导出完成:"`date "+%Y-%m-%d %H:%M:%S"`
echo "start prplfl4srepaircounthistory: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
echo "正在导出prplfl4srepaircounthistory表:"`date "+%Y-%m-%d %H:%M:%S"`
dbaccess $prpdb <<!
set isolation to dirty read;
unload to $LPLCEXPDIR/unl/prplfl4srepaircounthistory.unl select * from prplfl4srepaircounthistory where operatorcode like '13%';
!
echo "end prplfl4srepaircounthistory: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
compress -f $LPLCEXPDIR/unl/prplfl4srepaircounthistory.unl
echo "prplfl4srepaircounthistory表导出完成:"`date "+%Y-%m-%d %H:%M:%S"`
echo "start prplflvipreserve: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
echo "正在导出prplflvipreserve表:"`date "+%Y-%m-%d %H:%M:%S"`
dbaccess $prpdb <<!
set isolation to dirty read;
unload to $LPLCEXPDIR/unl/prplflvipreserve.unl select * from prplflvipreserve where substr(registno,9,2) = '13';
!
echo "end prplflvipreserve: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
compress -f $LPLCEXPDIR/unl/prplflvipreserve.unl
echo "prplflvipreserve表导出完成:"`date "+%Y-%m-%d %H:%M:%S"`
echo "start prplfl4sext: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
echo "正在导出prplfl4sext表:"`date "+%Y-%m-%d %H:%M:%S"`
dbaccess -e $prpdb >>$LPLCEXPDIR/log/unl_load.log 2>&1 <<!
dbaccess $prpdb <<!
set isolation to dirty read;
unload to $LPLCEXPDIR/unl/prplfl4sext.unl select * from prplfl4sext where agentcode like '13%';
!
echo "end prplfl4sext: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
compress -f $LPLCEXPDIR/unl/prplfl4sext.unl
echo "prplfl4sext表导出完成:"`date "+%Y-%m-%d %H:%M:%S"`
echo "start prplflclaiminfo: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
echo "正在导出prplflclaiminfo表:"`date "+%Y-%m-%d %H:%M:%S"`
dbaccess $prpdb <<!
set isolation to dirty read;
unload to $LPLCEXPDIR/unl/prplflclaiminfo.unl select * from prplflclaiminfo where substr(registno,9,2) = '13';
!
echo "end prplflclaiminfo: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
compress -f $LPLCEXPDIR/unl/prplflclaiminfo.unl
echo "prplflclaiminfo表导出完成:"`date "+%Y-%m-%d %H:%M:%S"`
echo "start prplflmaininfo: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
echo "正在导出prplflmaininfo表:"`date "+%Y-%m-%d %H:%M:%S"`
dbaccess $prpdb <<!
set isolation to dirty read;
unload to $LPLCEXPDIR/unl/prplflmaininfo.unl select * from prplflmaininfo where comcode like '13%';
!
echo "end prplflmaininfo: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
compress -f $LPLCEXPDIR/unl/prplflmaininfo.unl
echo "prplflmaininfo表导出完成:"`date "+%Y-%m-%d %H:%M:%S"`
echo "start prplflitemcar: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
echo "正在导出prplflitemcar表:"`date "+%Y-%m-%d %H:%M:%S"`
dbaccess $prpdb <<!
set isolation to dirty read;
unload to $LPLCEXPDIR/unl/prplflitemcar.unl select * from prplflitemcar where substr(registno,9,2) = '13';
!
echo "end prplflitemcar: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
compress -f $LPLCEXPDIR/unl/prplflitemcar.unl
echo "prplflitemcar表导出完成:"`date "+%Y-%m-%d %H:%M:%S"`
echo "start prplflthirdcar: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
echo "正在导出prplflthirdcar表:"`date "+%Y-%m-%d %H:%M:%S"`
dbaccess $prpdb <<!
set isolation to dirty read;
unload to $LPLCEXPDIR/unl/prplflthirdcar.unl select * from prplflthirdcar where substr(registno,9,2) = '13';
!
echo "end prplflthirdcar: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
compress -f $LPLCEXPDIR/unl/prplflthirdcar.unl
echo "prplflthirdcar表导出完成:"`date "+%Y-%m-%d %H:%M:%S"`
echo "start prplflflowmain: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
echo "正在导出prplflflowmain表:"`date "+%Y-%m-%d %H:%M:%S"`
dbaccess $prpdb <<!
set isolation to dirty read;
unload to $LPLCEXPDIR/unl/prplflflowmain.unl select * from prplflflowmain where comcode[1,2] = '13';
!
echo "end prplflflowmain: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
compress -f $LPLCEXPDIR/unl/prplflflowmain.unl
echo "prplflflowmain表导出完成:"`date "+%Y-%m-%d %H:%M:%S"`
echo "start prplflflowcond: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
echo "正在导出prplflflowcond表:"`date "+%Y-%m-%d %H:%M:%S"`
dbaccess $prpdb <<!
set isolation to dirty read;
unload to $LPLCEXPDIR/unl/prplflflowcond.unl select * from prplflflowcond where comcode[1,2] = '13';
!
echo "end prplflflowcond: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
compress -f $LPLCEXPDIR/unl/prplflflowcond.unl
echo "prplflflowcond表导出完成:"`date "+%Y-%m-%d %H:%M:%S"`
echo "start prplflconfigcode: "`date "+%Y-%m-%d %H:%M:%S"` >> $LPLCEXPDIR/log/unl_load.log
echo "正在导出prplflconfigcode表:"`date "+%Y-%m-%d %H:%M:%S"`
dbaccess