dump命令与脚本

## bak_src.exp.par
userid=system/dw123
directory=data_pump_dir
parallel=4
compression=all
schemas=(bill_ods,bill_dm,ETL_PLATFORM,dap_ods,dap_dw,dap_report)
----------------------------------------------------
#!/bin/bash
# User specific environment and startup programs
source /home/oracle/.bash_profile
# default retetion
if [ $# == 1 ];then
    DATE=${1}
else
    DATE=`date +%Y%m%d`;
fi
DATA_PUMP_DIR=/data/oracle/u02/dpdump;
PAR_FILE=bak_src.exp.par
TODAY_FILE=bak_src_dap_${DATE};
# pump data using data pump
cd ${DATA_PUMP_DIR}
rm -f ${TODAY_FILE}_*.dmp ${TODAY_FILE}.exp.log ${TODAY_FILE}.finish
${ORACLE_HOME}/bin/expdp parfile=${PAR_FILE} dumpfile=${TODAY_FILE}_%U.dmp logfile=${TODAY_FILE}.exp.log
tar zcvf ${TODAY_FILE}.tar.gz ${TODAY_FILE}_*.dmp ${TODAY_FILE}.exp.log
rm -f ${TODAY_FILE}_*.dmp ${TODAY_FILE}.exp.log
# generate the flag file
touch ${TODAY_FILE}.finish
# delete old dump file
find ${DATA_PUMP_DIR} -daystart -mtime +5 -type f -name "bak_src_*.tar.gz"|xargs rm -rf

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29076828/viewspace-1196297/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29076828/viewspace-1196297/

你可能感兴趣的:(dump命令与脚本)