rman备份脚本

归档备份

source ~/.bash_profile
export ORACLE_SID=XXXXXX
rman target / catalog xxxx/xxxx@XXX.XXX.XXX.XXX:1521/rcat <<eof
run{ allocate channel c1 device type disk format
'/backup/arch_%d_%T_%s_%p.bak'; allocate channel c2 device type disk format '/backup/arch_%d_%T_%s_%p.bak'; sql 'alter system archive log current'; backup as compressed backupset archivelog all delete input; } exit; eof

全备

source ~/.bash_profile
export ORACLE_SID=XXXXXX
rman target / catalog xxxx/xxxx@xxx.xxx.xxx.xxx:1521/rcat <<eof
run{ allocate channel c1 device type disk format
'/backup/full_%d_%T_%s_%p.bak'; allocate channel c2 device type disk format '/backup/full_%d_%T_%s_%p.bak'; allocate channel c3 device type disk format '/backup/full_%d_%T_%s_%p.bak'; sql 'alter system archive log current'; backup as compressed backupset database plus archivelog; backup current controlfile; backup spfile; crosscheck backup; delete noprompt obsolete; delete noprompt expired backup; } exit; eof

delete obsolete删除恢复数据库不需要的备份集,这个是根据保留策略的(configure retention policy to redundancy 1)

delete expired删除使用os命令删除的备份集信息

原文地址:https://www.cnblogs.com/monkey6/p/11765779.html