pt-archive

#archiver命令的安装路径
BASE_PATH=/usr/local/bin

定义 pt-archiver 参数变量

SOURCE_HOST=“”
SOURCE_PORT=“”
SOURCE_USER=“”
SOURCE_PASSWORD=“”
SOURCE_DATABASE=“”
SOURCE_CHARSET=“utf8”
SOURCE_PATH=“”
SOURCE_LOG_PATH=“”

#接受外部参数
START_DATE=$1
END_DATE=$2

获取当前系统时间

CURRENT_TIME= ( d a t e + " C U R R E N T D A T E = (date +"%Y-%m-%d %H:%M:%S") CURRENT_DATE= (date+"CURRENTDATE=(date +“%Y-%m-%d”)

定义日志文件路径 "数据库名+日期"作为日志文件名

LOG_FILE= S O U R C E L O G P A T H " a r c h i v e r − SOURCE_LOG_PATH"archiver- SOURCELOGPATH"archiverSOURCE_DATABASE-$(date +“%Y-%m-%d_%H-%M-%S”).log"

每处理 $PROGRESS 行数据时输出进度报告

PROGRESS=10000

每个事务中处理的最大行数,用于控制事务的大小

TXN_SIZE=1000

每个查询中返回的记录数的限制

LIMIT=1000

归档间隔时间

INTERVAL_DAY=365

if [ ! -d S O U R C E P A T H SOURCE_PATH SOURCEPATHCURRENT_DATE ];then
mkdir S O U R C E P A T H SOURCE_PATH SOURCEPATHCURRENT_DATE
else
echo “文件夹已经存在”
fi
echo “开始归档” >> L O G F I L E e c h o " LOG_FILE echo " LOGFILEecho"LOG_FILE" >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

开始备份 master表

echo “by_operation_master 开始备份: $START_DATE - $END_DATE " >> L O G F I L E C O M M O N M A S T E R = " LOG_FILE COMMON_MASTER=" LOGFILECOMMONMASTER="BASE_PATH/pt-archiver --source h= S O U R C E H O S T , P = SOURCE_HOST,P= SOURCEHOST,P=SOURCE_PORT,u= S O U R C E U S E R , p = SOURCE_USER,p= SOURCEUSER,p=SOURCE_PASSWORD,D= S O U R C E D A T A B A S E , t = b y o p e r a t i o n m a s t e r − − w h e r e s ¨ c h e d u l e d d a t e t i m e b e t w e e n ′ SOURCE_DATABASE,t=by_operation_master --where \"scheduled_date_time between ' SOURCEDATABASE,t=byoperationmasterwheres¨cheduleddatetimebetweenSTART_DATE’ and 'KaTeX parse error: Expected group as argument to '\"' at position 12: END_DATE'\" ̲--charset=SOURCE_CHARSET --no-delete --statistics --progress= P R O G R E S S − − l i m i t = PROGRESS --limit= PROGRESSlimit=LIMIT --txn-size=KaTeX parse error: Expected group as argument to '\"' at end of input: …SIZE --file=\"SOURCE_PATH C U R R E N T D A T E / CURRENT_DATE/ CURRENTDATE/START_DATE-$END_DATE-by_operation_master.txt”"
echo “归档命令: $COMMON_MASTER” >> $LOG_FILE
echo -e “\n” >> $LOG_FILE
echo “归档执行中,请稍等…” >> $LOG_FILE

执行归档命令

eval $COMMON_MASTER >> $LOG_FILE
echo “表名: by_operation_master $START_DATE - $END_DATE 归档完成” >> $LOG_FILE
echo -e “\n\n\n” >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

echo “###############################################################” >> $LOG_FILE

开始备份 by_operation_patient

echo “by_operation_patient 开始备份: $START_DATE - $END_DATE " >> L O G F I L E C O M M O N M A S T E R = " LOG_FILE COMMON_MASTER=" LOGFILECOMMONMASTER="BASE_PATH/pt-archiver --source h= S O U R C E H O S T , P = SOURCE_HOST,P= SOURCEHOST,P=SOURCE_PORT,u= S O U R C E U S E R , p = SOURCE_USER,p= SOURCEUSER,p=SOURCE_PASSWORD,D= S O U R C E D A T A B A S E , t = b y o p e r a t i o n p a t i e n t − − w h e r e o ¨ p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ SOURCE_DATABASE,t=by_operation_patient --where \"operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' SOURCEDATABASE,t=byoperationpatientwhereo¨perationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and 'KaTeX parse error: Expected group as argument to '\"' at position 13: END_DATE')\" ̲--charset=SOURCE_CHARSET --no-delete --statistics --progress= P R O G R E S S − − l i m i t = PROGRESS --limit= PROGRESSlimit=LIMIT --txn-size=KaTeX parse error: Expected group as argument to '\"' at end of input: …SIZE --file=\"SOURCE_PATH C U R R E N T D A T E / CURRENT_DATE/ CURRENTDATE/START_DATE-$END_DATE-by_operation_patient.txt”"
echo “归档命令: $COMMON_MASTER” >> $LOG_FILE
echo -e “\n” >> $LOG_FILE
echo “归档执行中,请稍等…” >> $LOG_FILE

执行归档命令

eval $COMMON_MASTER >> $LOG_FILE
echo “表名: by_operation_patient $START_DATE - $END_DATE 归档完成” >> $LOG_FILE
echo -e “\n\n\n” >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

echo “###############################################################” >> $LOG_FILE

开始备份 by_operation_staff

echo “by_operation_staff 开始备份: $START_DATE - $END_DATE " >> L O G F I L E C O M M O N M A S T E R = " LOG_FILE COMMON_MASTER=" LOGFILECOMMONMASTER="BASE_PATH/pt-archiver --source h= S O U R C E H O S T , P = SOURCE_HOST,P= SOURCEHOST,P=SOURCE_PORT,u= S O U R C E U S E R , p = SOURCE_USER,p= SOURCEUSER,p=SOURCE_PASSWORD,D= S O U R C E D A T A B A S E , t = b y o p e r a t i o n s t a f f − − w h e r e o ¨ p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ SOURCE_DATABASE,t=by_operation_staff --where \"operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' SOURCEDATABASE,t=byoperationstaffwhereo¨perationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and 'KaTeX parse error: Expected group as argument to '\"' at position 13: END_DATE')\" ̲--charset=SOURCE_CHARSET --no-delete --statistics --progress= P R O G R E S S − − l i m i t = PROGRESS --limit= PROGRESSlimit=LIMIT --txn-size=KaTeX parse error: Expected group as argument to '\"' at end of input: …SIZE --file=\"SOURCE_PATH C U R R E N T D A T E / CURRENT_DATE/ CURRENTDATE/START_DATE-$END_DATE-by_operation_staff.txt”"
echo “归档命令: $COMMON_MASTER” >> $LOG_FILE
echo -e “\n” >> $LOG_FILE
echo “归档执行中,请稍等…” >> $LOG_FILE

执行归档命令

eval $COMMON_MASTER >> $LOG_FILE
echo “表名: by_operation_staff $START_DATE - $END_DATE 归档完成” >> $LOG_FILE
echo -e “\n\n\n” >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

echo “###############################################################” >> $LOG_FILE

开始备份 by_operation_name

echo “by_operation_name 开始备份: $START_DATE - $END_DATE " >> L O G F I L E C O M M O N M A S T E R = " LOG_FILE COMMON_MASTER=" LOGFILECOMMONMASTER="BASE_PATH/pt-archiver --source h= S O U R C E H O S T , P = SOURCE_HOST,P= SOURCEHOST,P=SOURCE_PORT,u= S O U R C E U S E R , p = SOURCE_USER,p= SOURCEUSER,p=SOURCE_PASSWORD,D= S O U R C E D A T A B A S E , t = b y o p e r a t i o n n a m e − − w h e r e o ¨ p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ SOURCE_DATABASE,t=by_operation_name --where \"operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' SOURCEDATABASE,t=byoperationnamewhereo¨perationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and 'KaTeX parse error: Expected group as argument to '\"' at position 13: END_DATE')\" ̲--charset=SOURCE_CHARSET --no-delete --statistics --progress= P R O G R E S S − − l i m i t = PROGRESS --limit= PROGRESSlimit=LIMIT --txn-size=KaTeX parse error: Expected group as argument to '\"' at end of input: …SIZE --file=\"SOURCE_PATH C U R R E N T D A T E / CURRENT_DATE/ CURRENTDATE/START_DATE-$END_DATE-by_operation_name.txt”"
echo “归档命令: $COMMON_MASTER” >> $LOG_FILE
echo -e “\n” >> $LOG_FILE
echo “归档执行中,请稍等…” >> $LOG_FILE

执行归档命令

eval $COMMON_MASTER >> $LOG_FILE
echo “表名: by_operation_name $START_DATE - $END_DATE 归档完成” >> $LOG_FILE
echo -e “\n\n\n” >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

echo “###############################################################” >> $LOG_FILE

开始备份 by_operation_nursing_event

echo “by_operation_nursing_event 开始备份: $START_DATE - $END_DATE " >> L O G F I L E C O M M O N M A S T E R = " LOG_FILE COMMON_MASTER=" LOGFILECOMMONMASTER="BASE_PATH/pt-archiver --source h= S O U R C E H O S T , P = SOURCE_HOST,P= SOURCEHOST,P=SOURCE_PORT,u= S O U R C E U S E R , p = SOURCE_USER,p= SOURCEUSER,p=SOURCE_PASSWORD,D= S O U R C E D A T A B A S E , t = b y o p e r a t i o n n u r s i n g e v e n t − − w h e r e o ¨ p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ SOURCE_DATABASE,t=by_operation_nursing_event --where \"operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' SOURCEDATABASE,t=byoperationnursingeventwhereo¨perationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and 'KaTeX parse error: Expected group as argument to '\"' at position 13: END_DATE')\" ̲--charset=SOURCE_CHARSET --no-delete --statistics --progress= P R O G R E S S − − l i m i t = PROGRESS --limit= PROGRESSlimit=LIMIT --txn-size=KaTeX parse error: Expected group as argument to '\"' at end of input: …SIZE --file=\"SOURCE_PATH C U R R E N T D A T E / CURRENT_DATE/ CURRENTDATE/START_DATE-$END_DATE-by_operation_nursing_event.txt”"
echo “归档命令: $COMMON_MASTER” >> $LOG_FILE
echo -e “\n” >> $LOG_FILE
echo “归档执行中,请稍等…” >> $LOG_FILE

执行归档命令

eval $COMMON_MASTER >> $LOG_FILE
echo “表名: by_operation_nursing_event $START_DATE - $END_DATE 归档完成” >> $LOG_FILE
echo -e “\n\n\n” >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

echo “###############################################################” >> $LOG_FILE

开始备份 by_record

echo “by_record 开始备份: $START_DATE - $END_DATE " >> L O G F I L E C O M M O N M A S T E R = " LOG_FILE COMMON_MASTER=" LOGFILECOMMONMASTER="BASE_PATH/pt-archiver --source h= S O U R C E H O S T , P = SOURCE_HOST,P= SOURCEHOST,P=SOURCE_PORT,u= S O U R C E U S E R , p = SOURCE_USER,p= SOURCEUSER,p=SOURCE_PASSWORD,D= S O U R C E D A T A B A S E , t = b y r e c o r d − − w h e r e o ¨ p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ SOURCE_DATABASE,t=by_record --where \"operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' SOURCEDATABASE,t=byrecordwhereo¨perationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and 'KaTeX parse error: Expected group as argument to '\"' at position 13: END_DATE')\" ̲--charset=SOURCE_CHARSET --no-delete --statistics --progress= P R O G R E S S − − l i m i t = PROGRESS --limit= PROGRESSlimit=LIMIT --txn-size=KaTeX parse error: Expected group as argument to '\"' at end of input: …SIZE --file=\"SOURCE_PATH C U R R E N T D A T E / CURRENT_DATE/ CURRENTDATE/START_DATE-$END_DATE-by_record.txt”"
echo “归档命令: $COMMON_MASTER” >> $LOG_FILE
echo -e “\n” >> $LOG_FILE
echo “归档执行中,请稍等…” >> $LOG_FILE

执行归档命令

eval $COMMON_MASTER >> $LOG_FILE
echo “表名: by_record $START_DATE - $END_DATE 归档完成” >> $LOG_FILE
echo -e “\n\n\n” >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

echo “###############################################################” >> $LOG_FILE

开始备份 by_record_detail

echo “by_record_detail 开始备份: $START_DATE - $END_DATE " >> L O G F I L E C O M M O N M A S T E R = " LOG_FILE COMMON_MASTER=" LOGFILECOMMONMASTER="BASE_PATH/pt-archiver --source h= S O U R C E H O S T , P = SOURCE_HOST,P= SOURCEHOST,P=SOURCE_PORT,u= S O U R C E U S E R , p = SOURCE_USER,p= SOURCEUSER,p=SOURCE_PASSWORD,D= S O U R C E D A T A B A S E , t = b y r e c o r d d e t a i l − − w h e r e r ¨ e c o r d i d i n ( s e l e c t r e c o r d i d f r o m b y r e c o r d w h e r e o p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ SOURCE_DATABASE,t=by_record_detail --where \"record_id in (select record_id from by_record where operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' SOURCEDATABASE,t=byrecorddetailwherer¨ecordidin(selectrecordidfrombyrecordwhereoperationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and 'KaTeX parse error: Expected group as argument to '\"' at position 14: END_DATE'))\" ̲--charset=SOURCE_CHARSET --no-delete --statistics --progress= P R O G R E S S − − l i m i t = PROGRESS --limit= PROGRESSlimit=LIMIT --txn-size=KaTeX parse error: Expected group as argument to '\"' at end of input: …SIZE --file=\"SOURCE_PATH C U R R E N T D A T E / CURRENT_DATE/ CURRENTDATE/START_DATE-$END_DATE-by_record_detail.txt”"
echo “归档命令: $COMMON_MASTER” >> $LOG_FILE
echo -e “\n” >> $LOG_FILE
echo “归档执行中,请稍等…” >> $LOG_FILE

执行归档命令

eval $COMMON_MASTER >> $LOG_FILE
echo “表名: by_record_detail $START_DATE - $END_DATE 归档完成” >> $LOG_FILE
echo -e “\n\n\n” >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

echo “###############################################################” >> $LOG_FILE

开始备份 by_surgical_incision

echo “by_surgical_incision 开始备份: $START_DATE - $END_DATE " >> L O G F I L E C O M M O N M A S T E R = " LOG_FILE COMMON_MASTER=" LOGFILECOMMONMASTER="BASE_PATH/pt-archiver --source h= S O U R C E H O S T , P = SOURCE_HOST,P= SOURCEHOST,P=SOURCE_PORT,u= S O U R C E U S E R , p = SOURCE_USER,p= SOURCEUSER,p=SOURCE_PASSWORD,D= S O U R C E D A T A B A S E , t = b y s u r g i c a l i n c i s i o n − − w h e r e o ¨ p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ SOURCE_DATABASE,t=by_surgical_incision --where \"operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' SOURCEDATABASE,t=bysurgicalincisionwhereo¨perationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and 'KaTeX parse error: Expected group as argument to '\"' at position 13: END_DATE')\" ̲--charset=SOURCE_CHARSET --no-delete --statistics --progress= P R O G R E S S − − l i m i t = PROGRESS --limit= PROGRESSlimit=LIMIT --txn-size=KaTeX parse error: Expected group as argument to '\"' at end of input: …SIZE --file=\"SOURCE_PATH C U R R E N T D A T E / CURRENT_DATE/ CURRENTDATE/START_DATE-$END_DATE-by_surgical_incision.txt”"
echo “归档命令: $COMMON_MASTER” >> $LOG_FILE
echo -e “\n” >> $LOG_FILE
echo “归档执行中,请稍等…” >> $LOG_FILE

执行归档命令

eval $COMMON_MASTER >> $LOG_FILE
echo “表名: by_surgical_incision $START_DATE - $END_DATE 归档完成” >> $LOG_FILE
echo -e “\n\n\n” >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

echo “###############################################################” >> $LOG_FILE

开始备份 by_incision_instrument

echo “by_incision_instrument 开始备份: $START_DATE - $END_DATE " >> L O G F I L E C O M M O N M A S T E R = " LOG_FILE COMMON_MASTER=" LOGFILECOMMONMASTER="BASE_PATH/pt-archiver --source h= S O U R C E H O S T , P = SOURCE_HOST,P= SOURCEHOST,P=SOURCE_PORT,u= S O U R C E U S E R , p = SOURCE_USER,p= SOURCEUSER,p=SOURCE_PASSWORD,D= S O U R C E D A T A B A S E , t = b y i n c i s i o n i n s t r u m e n t − − w h e r e i ¨ n c i s i o n i d i n ( s e l e c t i n c i s i o n i d f r o m b y s u r g i c a l i n c i s i o n w h e r e o p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ SOURCE_DATABASE,t=by_incision_instrument --where \"incision_id in (select incision_id from by_surgical_incision where operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' SOURCEDATABASE,t=byincisioninstrumentwherei¨ncisionidin(selectincisionidfrombysurgicalincisionwhereoperationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and 'KaTeX parse error: Expected group as argument to '\"' at position 14: END_DATE'))\" ̲--charset=SOURCE_CHARSET --no-delete --statistics --progress= P R O G R E S S − − l i m i t = PROGRESS --limit= PROGRESSlimit=LIMIT --txn-size=KaTeX parse error: Expected group as argument to '\"' at end of input: …SIZE --file=\"SOURCE_PATH C U R R E N T D A T E / CURRENT_DATE/ CURRENTDATE/START_DATE-$END_DATE-by_incision_instrument.txt”"
echo “归档命令: $COMMON_MASTER” >> $LOG_FILE
echo -e “\n” >> $LOG_FILE
echo “归档执行中,请稍等…” >> $LOG_FILE

执行归档命令

eval $COMMON_MASTER >> $LOG_FILE
echo “表名: by_incision_instrument $START_DATE - $END_DATE 归档完成” >> $LOG_FILE
echo -e “\n\n\n” >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

echo “###############################################################” >> $LOG_FILE

开始备份 by_incision_check_record

echo “by_incision_check_record 开始备份: $START_DATE - $END_DATE " >> L O G F I L E C O M M O N M A S T E R = " LOG_FILE COMMON_MASTER=" LOGFILECOMMONMASTER="BASE_PATH/pt-archiver --source h= S O U R C E H O S T , P = SOURCE_HOST,P= SOURCEHOST,P=SOURCE_PORT,u= S O U R C E U S E R , p = SOURCE_USER,p= SOURCEUSER,p=SOURCE_PASSWORD,D= S O U R C E D A T A B A S E , t = b y i n c i s i o n c h e c k r e c o r d − − w h e r e i ¨ n c i s i o n i d i n ( s e l e c t i n c i s i o n i d f r o m b y s u r g i c a l i n c i s i o n w h e r e o p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ SOURCE_DATABASE,t=by_incision_check_record --where \"incision_id in (select incision_id from by_surgical_incision where operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' SOURCEDATABASE,t=byincisioncheckrecordwherei¨ncisionidin(selectincisionidfrombysurgicalincisionwhereoperationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and 'KaTeX parse error: Expected group as argument to '\"' at position 14: END_DATE'))\" ̲--charset=SOURCE_CHARSET --no-delete --statistics --progress= P R O G R E S S − − l i m i t = PROGRESS --limit= PROGRESSlimit=LIMIT --txn-size=KaTeX parse error: Expected group as argument to '\"' at end of input: …SIZE --file=\"SOURCE_PATH C U R R E N T D A T E / CURRENT_DATE/ CURRENTDATE/START_DATE-$END_DATE-by_incision_check_record.txt”"
echo “归档命令: $COMMON_MASTER” >> $LOG_FILE
echo -e “\n” >> $LOG_FILE
echo “归档执行中,请稍等…” >> $LOG_FILE

执行归档命令

eval $COMMON_MASTER >> $LOG_FILE
echo “表名: by_incision_check_record $START_DATE - $END_DATE 归档完成” >> $LOG_FILE
echo -e “\n\n\n” >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

echo “###############################################################” >> $LOG_FILE

开始备份 by_incision_check_detail

echo “by_incision_check_detail 开始备份: $START_DATE - $END_DATE " >> L O G F I L E C O M M O N M A S T E R = " LOG_FILE COMMON_MASTER=" LOGFILECOMMONMASTER="BASE_PATH/pt-archiver --source h= S O U R C E H O S T , P = SOURCE_HOST,P= SOURCEHOST,P=SOURCE_PORT,u= S O U R C E U S E R , p = SOURCE_USER,p= SOURCEUSER,p=SOURCE_PASSWORD,D= S O U R C E D A T A B A S E , t = b y i n c i s i o n c h e c k d e t a i l − − w h e r e c ¨ h e c k r e c o r d i d i n ( s e l e c t c h e c k r e c o r d i d f r o m b y i n c i s i o n c h e c k r e c o r d w h e r e i n c i s i o n i d i n ( s e l e c t i n c i s i o n i d f r o m b y s u r g i c a l i n c i s i o n w h e r e o p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ SOURCE_DATABASE,t=by_incision_check_detail --where \"check_record_id in (select check_record_id from by_incision_check_record where incision_id in (select incision_id from by_surgical_incision where operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' SOURCEDATABASE,t=byincisioncheckdetailwherec¨heckrecordidin(selectcheckrecordidfrombyincisioncheckrecordwhereincisionidin(selectincisionidfrombysurgicalincisionwhereoperationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and 'KaTeX parse error: Expected group as argument to '\"' at position 15: END_DATE')))\" ̲--charset=SOURCE_CHARSET --no-delete --statistics --progress= P R O G R E S S − − l i m i t = PROGRESS --limit= PROGRESSlimit=LIMIT --txn-size=KaTeX parse error: Expected group as argument to '\"' at end of input: …SIZE --file=\"SOURCE_PATH C U R R E N T D A T E / CURRENT_DATE/ CURRENTDATE/START_DATE-$END_DATE-by_incision_check_detail.txt”"
echo “归档命令: $COMMON_MASTER” >> $LOG_FILE
echo -e “\n” >> $LOG_FILE
echo “归档执行中,请稍等…” >> $LOG_FILE

执行归档命令

eval $COMMON_MASTER >> $LOG_FILE
echo “表名: by_incision_check_detail $START_DATE - $END_DATE 归档完成” >> $LOG_FILE
echo -e “\n\n\n” >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

echo “###############################################################” >> $LOG_FILE

开始备份 by_operation_remark

echo “by_operation_remark 开始备份: $START_DATE - $END_DATE " >> L O G F I L E C O M M O N M A S T E R = " LOG_FILE COMMON_MASTER=" LOGFILECOMMONMASTER="BASE_PATH/pt-archiver --source h= S O U R C E H O S T , P = SOURCE_HOST,P= SOURCEHOST,P=SOURCE_PORT,u= S O U R C E U S E R , p = SOURCE_USER,p= SOURCEUSER,p=SOURCE_PASSWORD,D= S O U R C E D A T A B A S E , t = b y o p e r a t i o n r e m a r k − − w h e r e i ¨ n c i s i o n i d i n ( s e l e c t i n c i s i o n i d f r o m b y s u r g i c a l i n c i s i o n w h e r e o p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ SOURCE_DATABASE,t=by_operation_remark --where \"incision_id in (select incision_id from by_surgical_incision where operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' SOURCEDATABASE,t=byoperationremarkwherei¨ncisionidin(selectincisionidfrombysurgicalincisionwhereoperationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and 'KaTeX parse error: Expected group as argument to '\"' at position 14: END_DATE'))\" ̲--charset=SOURCE_CHARSET --no-delete --statistics --progress= P R O G R E S S − − l i m i t = PROGRESS --limit= PROGRESSlimit=LIMIT --txn-size=KaTeX parse error: Expected group as argument to '\"' at end of input: …SIZE --file=\"SOURCE_PATH C U R R E N T D A T E / CURRENT_DATE/ CURRENTDATE/START_DATE-$END_DATE-by_operation_remark.txt”"
echo “归档命令: $COMMON_MASTER” >> $LOG_FILE
echo -e “\n” >> $LOG_FILE
echo “归档执行中,请稍等…” >> $LOG_FILE

执行归档命令

eval $COMMON_MASTER >> $LOG_FILE
echo “表名: by_operation_remark $START_DATE - $END_DATE 归档完成” >> $LOG_FILE
echo -e “\n\n\n” >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

echo “###############################################################” >> $LOG_FILE

开始备份 by_sign_record

echo “by_sign_record 开始备份: $START_DATE - $END_DATE " >> L O G F I L E C O M M O N M A S T E R = " LOG_FILE COMMON_MASTER=" LOGFILECOMMONMASTER="BASE_PATH/pt-archiver --source h= S O U R C E H O S T , P = SOURCE_HOST,P= SOURCEHOST,P=SOURCE_PORT,u= S O U R C E U S E R , p = SOURCE_USER,p= SOURCEUSER,p=SOURCE_PASSWORD,D= S O U R C E D A T A B A S E , t = b y s i g n r e c o r d − − w h e r e b ¨ u s i n e s s i d i n ( s e l e c t r e c o r d i d f r o m b y r e c o r d w h e r e o p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ SOURCE_DATABASE,t=by_sign_record --where \"business_id in (select record_id from by_record where operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' SOURCEDATABASE,t=bysignrecordwhereb¨usinessidin(selectrecordidfrombyrecordwhereoperationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and ‘ E N D D A T E ′ ) U N I O N s e l e c t i n c i s i o n i d f r o m b y s u r g i c a l i n c i s i o n w h e r e o p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ END_DATE') UNION select incision_id from by_surgical_incision where operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' ENDDATE)UNIONselectincisionidfrombysurgicalincisionwhereoperationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and ‘ E N D D A T E ′ ) U N I O N s e l e c t c h e c k r e c o r d i d f r o m b y i n c i s i o n c h e c k r e c o r d w h e r e i n c i s i o n i d i n ( s e l e c t i n c i s i o n i d f r o m b y s u r g i c a l i n c i s i o n w h e r e o p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ END_DATE') UNION select check_record_id from by_incision_check_record where incision_id in (select incision_id from by_surgical_incision where operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' ENDDATE)UNIONselectcheckrecordidfrombyincisioncheckrecordwhereincisionidin(selectincisionidfrombysurgicalincisionwhereoperationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and 'KaTeX parse error: Expected group as argument to '\"' at position 15: END_DATE')))\" ̲--charset=SOURCE_CHARSET --no-delete --statistics --progress= P R O G R E S S − − l i m i t = PROGRESS --limit= PROGRESSlimit=LIMIT --txn-size=KaTeX parse error: Expected group as argument to '\"' at end of input: …SIZE --file=\"SOURCE_PATH C U R R E N T D A T E / CURRENT_DATE/ CURRENTDATE/START_DATE-$END_DATE-by_sign_record.txt”"
echo “归档命令: $COMMON_MASTER” >> $LOG_FILE
echo -e “\n” >> $LOG_FILE
echo “归档执行中,请稍等…” >> $LOG_FILE

执行归档命令

eval $COMMON_MASTER >> $LOG_FILE
echo “表名: by_sign_record $START_DATE - $END_DATE 归档完成” >> $LOG_FILE
echo -e “\n\n\n” >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

echo “###############################################################” >> $LOG_FILE

开始备份 by_ca_sign_record

echo “by_ca_sign_record 开始备份: $START_DATE - $END_DATE " >> L O G F I L E C O M M O N M A S T E R = " LOG_FILE COMMON_MASTER=" LOGFILECOMMONMASTER="BASE_PATH/pt-archiver --source h= S O U R C E H O S T , P = SOURCE_HOST,P= SOURCEHOST,P=SOURCE_PORT,u= S O U R C E U S E R , p = SOURCE_USER,p= SOURCEUSER,p=SOURCE_PASSWORD,D= S O U R C E D A T A B A S E , t = b y c a s i g n r e c o r d − − w h e r e s ¨ i g n r e c o r d i d i n ( s e l e c t s i g n r e c o r d i d f r o m b y s i g n r e c o r d w h e r e b u s i n e s s i d i n ( s e l e c t r e c o r d i d f r o m b y r e c o r d w h e r e o p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ SOURCE_DATABASE,t=by_ca_sign_record --where \"sign_record_id in (select sign_record_id from by_sign_record where business_id in (select record_id from by_record where operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' SOURCEDATABASE,t=bycasignrecordwheres¨ignrecordidin(selectsignrecordidfrombysignrecordwherebusinessidin(selectrecordidfrombyrecordwhereoperationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and ‘ E N D D A T E ′ ) U N I O N s e l e c t i n c i s i o n i d f r o m b y s u r g i c a l i n c i s i o n w h e r e o p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ END_DATE') UNION select incision_id from by_surgical_incision where operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' ENDDATE)UNIONselectincisionidfrombysurgicalincisionwhereoperationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and ‘ E N D D A T E ′ ) U N I O N s e l e c t c h e c k r e c o r d i d f r o m b y i n c i s i o n c h e c k r e c o r d w h e r e i n c i s i o n i d i n ( s e l e c t i n c i s i o n i d f r o m b y s u r g i c a l i n c i s i o n w h e r e o p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ END_DATE') UNION select check_record_id from by_incision_check_record where incision_id in (select incision_id from by_surgical_incision where operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' ENDDATE)UNIONselectcheckrecordidfrombyincisioncheckrecordwhereincisionidin(selectincisionidfrombysurgicalincisionwhereoperationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and 'KaTeX parse error: Expected group as argument to '\"' at position 16: END_DATE'))))\" ̲--charset=SOURCE_CHARSET --no-delete --statistics --progress= P R O G R E S S − − l i m i t = PROGRESS --limit= PROGRESSlimit=LIMIT --txn-size=KaTeX parse error: Expected group as argument to '\"' at end of input: …SIZE --file=\"SOURCE_PATH C U R R E N T D A T E / CURRENT_DATE/ CURRENTDATE/START_DATE-$END_DATE-by_ca_sign_record.txt”"
echo “归档命令: $COMMON_MASTER” >> $LOG_FILE
echo -e “\n” >> $LOG_FILE
echo “归档执行中,请稍等…” >> $LOG_FILE

执行归档命令

eval $COMMON_MASTER >> $LOG_FILE
echo “表名: by_ca_sign_record $START_DATE - $END_DATE 归档完成” >> $LOG_FILE
echo -e “\n\n\n” >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

echo “###############################################################” >> $LOG_FILE

开始备份 by_archived_record_log

echo “by_archived_record_log 开始备份: $START_DATE - $END_DATE " >> L O G F I L E C O M M O N M A S T E R = " LOG_FILE COMMON_MASTER=" LOGFILECOMMONMASTER="BASE_PATH/pt-archiver --source h= S O U R C E H O S T , P = SOURCE_HOST,P= SOURCEHOST,P=SOURCE_PORT,u= S O U R C E U S E R , p = SOURCE_USER,p= SOURCEUSER,p=SOURCE_PASSWORD,D= S O U R C E D A T A B A S E , t = b y a r c h i v e d r e c o r d l o g − − w h e r e a ¨ r c h i v e d r e c o r d i d i n ( s e l e c t r e c o r d i d f r o m b y r e c o r d w h e r e o p e r a t i o n i d i n ( s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ SOURCE_DATABASE,t=by_archived_record_log --where \"archived_record_id in (select record_id from by_record where operation_id in (select operation_id from by_operation_master where scheduled_date_time between ' SOURCEDATABASE,t=byarchivedrecordlogwherea¨rchivedrecordidin(selectrecordidfrombyrecordwhereoperationidin(selectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and ‘ E N D D A T E ′ ) U N I O N s e l e c t o p e r a t i o n i d f r o m b y o p e r a t i o n m a s t e r w h e r e s c h e d u l e d d a t e t i m e b e t w e e n ′ END_DATE') UNION select operation_id from by_operation_master where scheduled_date_time between ' ENDDATE)UNIONselectoperationidfrombyoperationmasterwherescheduleddatetimebetweenSTART_DATE’ and 'KaTeX parse error: Expected group as argument to '\"' at position 13: END_DATE')\" ̲--charset=SOURCE_CHARSET --no-delete --statistics --progress= P R O G R E S S − − l i m i t = PROGRESS --limit= PROGRESSlimit=LIMIT --txn-size=KaTeX parse error: Expected group as argument to '\"' at end of input: …SIZE --file=\"SOURCE_PATH C U R R E N T D A T E / CURRENT_DATE/ CURRENTDATE/START_DATE-$END_DATE-by_archived_record_log.txt”"
echo “归档命令: $COMMON_MASTER” >> $LOG_FILE
echo -e “\n” >> $LOG_FILE
echo “归档执行中,请稍等…” >> $LOG_FILE

执行归档命令

eval $COMMON_MASTER >> $LOG_FILE
echo “表名: by_archived_record_log $START_DATE - $END_DATE 归档完成” >> $LOG_FILE
echo -e “\n\n\n” >> $LOG_FILE
echo “###############################################################” >> $LOG_FILE

echo “开始压缩” >> $LOG_FILE
#COMMON_TRA="tar -czf S T A R T D A T E − START_DATE- STARTDATEEND_DATE.tar.gz $CURRENT_DATE "
COMMON_TRA="pwd "
#eval $COMMON_TRA >> $LOG_FILE
echo “压缩完成” >> $LOG_FILE

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/2609.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

MongoDB简介

一.MongoDB相关概念 1.1.简介 MongoDB是一个开源,高性能,无模式的文档性数据库,当初的设计就是用于简化开发和方便扩展,是NoSQL数据库产品中的一种。是最像关系型数据库(MySQL)的非关系数据库。 它支持的…

Socket篇(学习前言)

目录 一、计算机网络 二、网络编程 三、网络编程三要素 1. IP地址 1.1. 简介 1.2. IP地址分为两大类 IPv4 IPv6 1.3. IP地址形式 1.4. DOS常用命令 1.5. 特殊IP地址 2. 端口 2.1. 简介 2.2. 端口号 2.3. 端口类型 周知端口 注册端口 动态端口 3. 协议 3.1. …

【专题】基于服务的体系结构

对于面向服务的体系结构(Service-Oriented Architecture,SOA)的几种定义: W3C:SOA是一种应用程序体系结构,在这种体系结构中,所有功能都定义为独立的服务,这些服务带有定义明确的可…

AMD显卡低负载看视频掉驱动(chrome edge浏览器) 高负载玩游戏却稳定 解决方法——关闭MPO

问题 折磨的开始是天下苦黄狗久矣,为了不再被讨乞丐的显存恶心,一怒之下购入了AMD显卡(20GB显存确实爽 头一天就跑了3dmark验机,完美通过,玩游戏也没毛病 但是呢这厮是一点不省心,玩游戏没问题&#xff0c…

小容器拉动大市场 全面云原生化刻不容缓

毋庸置疑,容器技术的发展推动了云原生计算革命。当前,在云原生已经成为企业用云新常态的情况下,作为一项核心能力,容器管理与服务也成了检验云服务商的试金石。Omdia最新发布的《Omdia Universe: Cloud Container Management &…

一招帮你搞懂数据结构的插入、删除

目录 一、尾部插入(添加) 1.初始化 2.一个打印数组的函数 3.尾插 4.完整版 二、任意位置插入 1.流程图 2.任意插 3.完整版 三、指定数据删除 1.流程图 2. 删除(首位查找到的元素) 四、删除所有 思想 代码 五、有序…

二叉树相关算法

满二叉树:每层都是满的 完全二叉树:特殊的满二叉树,可以有一个子节点,但最后一层必须是从左到右排列,中间不能有空隙,强调除了最后一层外,其他层都是满的 一、dfs深度搜索 例题:求…

Sigrity Power SI VR noise Metrics check模式如何进行电源噪声耦合分析操作指导

SSigrity Power SI VR noise Metrics check模式如何进行电源噪声耦合分析操作指导 Sigrity Power SI的VR noise Metrics check模式本质上是用来评估和观测器件的电源网络的耦合对于信号的影响,输出S参数以及列出具体的贡献值。 以下图为例

OpenGL入门004——使用EBO绘制矩形

本节将利用EBO来绘制矩形 文章目录 一些概念EBO 实战简介utilswindowFactory.hRectangleModel.hRectangleModel.cpp main.cppCMakeLists.txt最终效果 一些概念 EBO 概述: Element Buffer Object 用于存储顶点的索引数据,以便在绘制图形时可以重用顶点数…

Qt 视口和窗口

Qt 视口和窗口 1、视口和窗口的定义与原理 绘图设备的物理坐标是基本的坐标系,通过 QPainter 的平移、旋转等变换可以得到更容易操作的逻辑坐标。 为了实现更方便的坐标,QPainter 还提供了视口 (Viewport)和窗口 (Window)坐标系,通过Q…

hunyuan-DiT模型部署指南

一、介绍 Hunyuan-DiT是由腾讯混元推出的扩散模型,支持中文和英文双语输入,其他开源模型相比,Hunyuan-DiT 在中文到图像生成方面树立了新的水平。 二、部署流程 环境要求: 所需的最小 GPU 内存为 11GB, 建议使用具…

Pytorch学习--神经网络--搭建小实战(手撕CIFAR 10 model structure)和 Sequential 的使用

一、Sequential 的使用方法 在手撕代码中进一步体现 torch.nn.Sequential 二、手撕 CIFAR 10 model structure 手撕代码: import torch from torch import nn from torch.nn import Conv2d, MaxPool2d, Flatten, Linear from torch.utils.tensorboard import Su…

硬件测试工程师之EMC项目-电磁干扰-谐波测试标准解析思维导图

1:链接上一篇文章 ​​​​​​​相关链接:https://blog.csdn.net/weixin_49492286/article/details/135210741 2:重新总结思维导图并进行深入解析EMC-谐波测试项目 本人重新再次总结这个EMC谐波的标准解析思维导图,并且附上相…

ArcGIS 地理信息系统 任意文件读取漏洞复现

0x01 产品简介 ArcGIS是由美国Esri公司研发的地理信息系统(GIS)软件,它整合了数据库、软件工程、人工智能、网络技术、云计算等主流的IT技术,旨在为用户提供一套完整的、开放的企业级GIS解决方案,它包含了一套带有用户界面组件的Windows桌面应用。可以实现从简单到复杂的…

安全合规:沃尔玛自养号测评技术搭建要点

沃尔玛自养号测评技术的搭建是一个复杂且需综合考量多方面因素的过程,以下是对其技术搭建的详细解析: 一、硬件与网络环境搭建 硬件参数伪装: 利用国外服务器在云端搭建安全终端,全面阻断沃尔玛平台对设备底层硬件参数的检测&a…

Ps:天空替换

Ps菜单:编辑/天空替换 Edit/Sky Replacement Ps菜单:选择/天空 Select/Sky 天空替换 Sky Replacement命令能够自动分析前景与天空,利用 Adobe Sensei 技术也大大减轻了制作蒙版的负担,可以直观、智能、快速地实现天空替换。 到目…

【JavaEE初阶】网络编程TCP协议实现回显服务器以及如何处理多个客户端的响应

前言 🌟🌟本期讲解关于TCP/UDP协议的原理理解~~~ 🌈感兴趣的小伙伴看一看小编主页:GGBondlctrl-CSDN博客 🔥 你的点赞就是小编不断更新的最大动力 🎆那么废话不多说…

MySQL 9从入门到性能优化-加密函数

【图书推荐】《MySQL 9从入门到性能优化(视频教学版)》-CSDN博客 《MySQL 9从入门到性能优化(视频教学版)(数据库技术丛书)》(王英英)【摘要 书评 试读】- 京东图书 (jd.com) MySQL9数据库技术_夏天又到了…

探索空间计算与 VR 设备的未来:4K4DGen 高分辨率全景 4D 内容生成系统

在当今科技飞速发展的时代,空间计算和 VR 设备正逐渐成为人们体验沉浸式场景的重要工具。而今天,我们要为大家介绍一款具有创新性的技术 ——4K4DGen 高分辨率全景 4D 内容生成系统,它为 VR/AR 沉浸式体验带来了全新的可能性。 一、项目概述 4K4DGen 项目的核心目标是实现 …

Unity中实现伤害飘字或者提示飘字效果(DoTween实现版本)

!!!在实现以下效果之前,一定要往项目中导入DoTween插件。 一、搭建测试场景 1、在场景中新建一个带有Text组件的游戏物体A,并把这个游戏物体A中Text组件的Color属性中alpha值为0,让文字在场景中隐藏。 …