ITPub博客

首页 > 数据库 > Oracle > Oracle 11g EXPDP、RMAN自动备份SHELL脚本

Oracle 11g EXPDP、RMAN自动备份SHELL脚本

原创 Oracle 作者:feelpurple 时间:2016-06-23 11:11:48 0 删除 编辑
#!/bin/sh
umask 022
set -o vi

export ORACLE_SID=market
export ORACLE_BASE=/app/usr/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11gr2
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
export PATH=$PATH:$ORACLE_HOME/bin:$PATH
export LANG=en_US.UTF-8
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
#EXPDP
find /app/usr/oracle/bk -ctime +3 -print | xargs rm;
now=`date +%Y%m%d`
expdp system/System#2013 directory=bk schemas=market dumpfile=market_$now.dmp logfile=expdp_$now.log
#RMAN
rman target / log=/home/oracle/log/rman_$now.log << EOF
run {
configure retention policy to recovery window of 2 days;
configure controlfile autobackup on;
configure controlfile autobackup format for device type disk to '/app/usr/oracle/bk/cf_%F';
allocate channel C1 device type disk format '/app/usr/oracle/bk/rman_%U';
backup as compressed backupset database skip inaccessible
plus archivelog filesperset 20
delete all input;
release channel C1;
}

allocate channel for maintenance device type disk;
crosscheck backupset;
delete noprompt obsolete;
DELETE EXPIRED BACKUP;
exit
EOF

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

请登录后发表评论 登录
全部评论

注册时间:2014-08-01

  • 博文量
    404
  • 访问量
    1673978