source /home/oracle/.bash_profile
RMAN_LOG_FILE=fulldate +%Y%m%d
.log
export ORACLE_SID=rdb
export ORACLE_HOME=/oracle/app/oracle/product/11.2.0/dbhome_1
/oracle/app/oracle/product/11.2.0/dbhome_1/bin/rman target / log=/dumpdata/rman_bak/$RMAN_LOG_FILE append <<EOF
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt archivelog all completed before ‘SYSDATE-2’;
run {
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
backup as compressed backupset INCREMENTAL LEVEL 0 FILESPERSET 10 FORMAT ‘/dumpdata/rman_bak/rdb_data_%T_%s’ database;
sql ‘alter system archive log current’;
backup as compressed backupset filesperset 20 format ‘/dumpdata/rman_bak/rdb_arch_%T_%s’ skip inaccessible archivelog ALL not backed up;
backup format ‘/dumpdata/rman_bak/rdb_cont_%T_%s’ current controlfile;
release channel t1;
release channel t2;
release channel t3;
release channel t4;
}
exit;
EOF
chmod 755 /dumpdata/rman_bak/*
rman备份脚本(备份database、archivelog、controlfile)
最新推荐文章于 2024-07-18 14:34:06 发布