rman全备脚本

cat rman_back.sh
#!/bin/bash
source /home/oracle/.bash_profile
 
rman log=/u01/backup/backupall_rman.log <<EOF
connect target /
 
run
{
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS;
allocate channel dev1 device type disk maxpiecesize 5G;
backup as compressed backupset database format  '/u01/backup/full_db_%T_%d_%s_%p_%u';
release channel dev1;
}
 
run
{
backup as compressed backupset archivelog all delete all input format '/u01/backup/archivelog_%T_%s_%p_%u';
backup spfile format '/u01/backup/spfile_%T_%s_%p_%u';
backup current controlfile format  '/u01/backup/controlfile_%T_%s_%p_%u';
 
}
 
crosscheck archivelog all;
delete noprompt expired archivelog all;
crosscheck backup;
delete noprompt expired backup;
report obsolete;
delete noprompt obsolete;
exit;
EOF
posted @ 2020-03-26 15:22  Manger  阅读(407)  评论(0编辑  收藏  举报