ITPub博客

首页 > 数据库 > Oracle > 分享Oracle Rman的备份脚本

分享Oracle Rman的备份脚本

原创 Oracle 作者:flybluey 时间:2019-09-21 09:34:09 0 删除 编辑

#########################################################################

# File Name: backup.sh

# Created Time:XXXXX

# This is rman auto full backup script 

#########################################################################

#!/bin/bash


export ORACLE_SID=XXXX

export ORACLE_BASE=/oracle

export ORACLE_HOME=/oracle/11.2.0.4/db_1

export PATH=$ORACLE_HOME/bin:$PATH


rman target / nocatalog log=/rmanbak/XXXX/rman.log append<<EOF


run{

allocate channel c1 device type disk;

allocate channel c2 device type disk;


crosscheck backup;

sql 'alter system archive log current';

backup as compressed backupset database format '/rmanbak/XXXX/db_%d_%T_%s_%p.bak';

sql 'alter system archive log current';

backup archivelog all format '/rmanbak/XXXX/arch_%d_%T_%s_%p.bak';

backup current controlfile format '/rmanbak/XXXX/ctl%d_%T_%s.bak';


delete noprompt obsolete;

crosscheck archivelog all;

delete noprompt expired archivelog all;

crosscheck backup;

delete noprompt expired backup;

DELETE noprompt ARCHIVELOG FROM TIME 'SYSDATE-3';

release channel c1;

release channel c2;

}


EOF

echo "backup complete!"


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

请登录后发表评论 登录
全部评论
长期从事数据库相关行业职务。

注册时间:2015-10-14

  • 博文量
    13
  • 访问量
    14080