bak_database.sh
上传用户:wangdh1989
上传日期:2022-02-19
资源大小:1k
文件大小:2k
- . /home/oracle/.bash_profile
- echo "####################################begin####################################"
- date
- #*** check reentrancy
- cnt=`ps -eaf|grep gmcc|grep bak_database.sh|grep -v grep|grep -v vi|wc -l`
- if [ $cnt -ge 2 ];then
- echo "******precess already running!"
- echo $cnt
- echo `ps -eaf|grep gmcc|grep bak_database.sh|grep -v grep|grep -v vi`
- exit 1
- fi
- echo `ps -eaf|grep gmcc|grep bak_database.sh|grep -v grep|grep -v vi`
- #####备份策略
- #Mon: 完全备份(A)
- #Tue: 增量导出(B)
- #Wed:增量导出(C)
- #Thu: 增量导出(D)
- #Fri: 累计导出(E)
- #Sat: 增量导出(F)
- #Sun: 增量导出(G)
- v_workdir="/backup/expdb/"
- v_logdir="/backup/expdb/log/"
- v_weekno=`date "+%U"`
- v_weekseq=`date "+%w"`
- v_date=`date "+%Y%m%d"`
- v_endweek="52"
- if [ ${v_weekseq} -eq 0 ]; then
- if [ ${v_weekno} -eq 1 ];then
- v_weekno=52
- else
- v_weekno=`expr ${v_weekno} - 1`
- fi
- fi
- v_complete=WEEK_${v_weekno}_${v_date}_complete.dmp
- v_cumulative=WEEK_${v_weekno}_${v_date}_cumulative.dmp
- v_incremental=WEEK_${v_weekno}_${v_date}_incremental.dmp
- ftp_put_on(){
- ftp -inv -<< EOF
- open 10.250.252.45
- user gmcc gmcctds0753
- bin
- put $1
- EOF
- }
- if [ ${v_weekseq} -eq "1" ]; then
- #完全备份
- exp system/system0753@scana inctype=complete file=${v_workdir}${v_complete} log=${v_logdir}exp.log
- # ftp_put_on ${v_workdir}${v_complete}
- elif [ ${v_weekseq} -eq "5" ];then
- #累计导出
- exp system/system0753@scana inctype=cumulative file=${v_workdir}${v_cumulative} log=${v_logdir}exp.log
- # ftp_put_on ${v_workdir}${v_cumulative}
- else
- #增量导出
- exp system/system0753@scana inctype=incremental file=${v_workdir}${v_incremental} log=${v_logdir}exp.log
- # ftp_put_on ${v_workdir}${v_incremental}
- fi
- #恢复步骤:表空间分配参照梅州移动数据支撑系统_操作系统与数据库安装报告V1.doc
- #第一步:用命令CREATE DATABASE重新生成数据库结构;
- #第二步:创建一个足够大的附加回滚。
- #第三步:完全增量导入A:
- #imp system/guitar inctype=RESTORE FULL=y FILE=_complete.dmp
- #第四步:累计增量导入E:
- #imp system/guitar inctype=RESTORE FULL=Y FILE=20090717_incremental.dmp
- #第五步:最近增量导入F:
- #imp system/guitar inctype=RESTORE FULL=Y FILE=cumulative.dmp
- #根据时间点来组合导入