码迷,mamicode.com
首页 > 数据库 > 详细

oracle备份脚本(三-rman0级全备)

时间:2020-04-13 14:12:15      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:get   man   NPU   sys   ack   alter   cat   name   oca   

 

#!/bin/bash

export ORACLE_SID=test
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export ORACLE_BASE=//u01/app/oracle
backtime=`date +"20%y%m%d%H%M%S"`
cd $ORACLE_HOME/bin
rman target / log=/bak/log/backupall_$backtime.log <<EOF
run {
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
backup incremental level 0 database format ‘/bak/level0/level0_%d_%s_%p_%u.bak‘
tag=‘level 0‘ include current controlfile;
sql ‘alter system archive log current‘;
backup archivelog all format ‘/bak/arch/log_%d_%s_%p_%u.bak‘ delete all input;
release channel d3;
release channel d2;
release channel d1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
EOF


find /orabak/level0/ -mtime +7 -name "*.bak" -exec rm -rf {} \;
find /orabak/arch/ -mtime +5 -name "*.bak" -exec rm -rf {} \;

oracle备份脚本(三-rman0级全备)

标签:get   man   NPU   sys   ack   alter   cat   name   oca   

原文地址:https://www.cnblogs.com/zhm1985/p/12690838.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!