更新时间:2021-09-04 16:53:19
#!/bin/bash
#this is rman auto incr backup script
backtime=$(date +%Y%m%d%H%M)
if [ -f ~/.bash_profile ];
then
. ~/.bash_profile
fi
rman target / log=/backup/log/incr_$backtime.log <<EOF
run {
sql 'alter system archive log current';
allocate channel c1 type disk;
allocate channel c2 type disk;
backup as compressed backupset
tag incr_backup_level1
incremental level 1
format '/backup/oradata/level1_%T_%t_s%s_p%p.bak' database;
sql 'alter system archive log current';
backup as compressed backupset format '/backup/arch/archlog_%T_t%t_s%s_p%p.bak' archivelog all delete input;
release channel c1;
release channel c2;
allocate channel d1 type disk;
backup
format '/backup/control/controlfile_%T_s%s_p%p.bak'
current controlfile;
crosscheck backup;
crosscheck copy;
delete noprompt expired backup;
delete noprompt obsolete;
delete noprompt backup of database completed before'sysdate-7';
release channel d1;
}
EOF