Скрипты RMAN

backup

Скрипт rman под windows сервер

rman_bkp_f.bat:


set ORACLE_HOME=D:\oracle\product\10.2.0\db_1
D:\oracle\product\10.2.0\db_1\bin\rman target sys/sys@SID

rman_bkp_f.txt:


run
{

CONFIGURE RETENTION POLICY TO REDUNDANCY 14;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
#CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'C:\FRA\%d\AUTOBACKUP\CF_%d_%F';
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET;
backup as compressed backupset full database plus archivelog delete all input;
crosscheck archivelog all;
crosscheck backup;
crosscheck copy;
delete noprompt obsolete;
backup validate database;
restore database validate;
restore spfile validate;
restore controlfile validate;
restore archivelog from time 'sysdate-1' validate;
}

 

Скрипт rman под linux сервер

crontab:

0 2 * * * oracle /u01/app/oracle/admin/rmanbackup.sh

rmanbackup.sh:


# export variables
ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export ORACLE_HOME
ORACLE_SID=testdb
export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH
export PATH
LOGFILE=/u01/app/oracle/admin/backup.log
rman target /  $LOGFILE
set echo on;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
#CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET;
show all;
report unrecoverable;
# actual backup
#backup full database noexclude include current controlfile spfile;
backup database plus archivelog;
# delete obsolete;
# report obsolete;
delete force noprompt obsolete;
# crosscheck
crosscheck archivelog all;
delete noprompt expired archivelog all;
crosscheck backup;
delete noprompt expired backup;
crosscheck copy;
delete noprompt expired copy;
list backup;
list backup summary;
list backup recoverable;
report unrecoverable;
restore database validate;
restore spfile validate;
exit
ERMAN