Rman
Jump to navigation
Jump to search
Rman script windows
@echo off for /f "skip=2" %%x in ('wmic Path Win32_LocalTime get Day^,DayOfWeek /Format:List') do set %%x >NUL rem echo %Day% %DayOfWeek% rem Sovrascrivi per prove rem set Day=1 rem set DayOfWeek=1 rem echo %Day% %DayOfWeek% set BCK=ORD if %DayOfWeek% EQU 0 set BCK=LT180 if %DayOfWeek% EQU 0 if %Day% GTR 7 set BCK=LT35 echo %BCK% ( echo spool log to %BCK%.log echo list expired backup; echo spool log off; ) > %BCK%.rman set ORACLE_SID=XXXXXXX set NLS_LANG=ITALIAN_ITALY.WE8MSWIN1252 set NLS_DATE_FORMAT=DD-MM-YYYY HH24:MI:SS rman target / nocatalog cmdfile %BCK%.rman
Rman script linux
#!/bin/sh # versione 12/09/2014 EG DAYW=$( date +%w ) case $DAYW in 0) LEVEL=" incremental level 0 " DAY=$( date +%d ) if [ $DAY -gt 7 ] then TAG="LT35LEV0" KEEP=" keep until time 'sysdate+35' " else TAG="LT180LEV0" KEEP=" keep until time 'sysdate+180' " fi ;; *) LEVEL=" incremental level 1 cumulative " TAG="LEV1" KEEP="" ;; esac NLS_DATE_FORMAT='DD-MM-YYYY HH24:MI:SS'; export NLS_DATE_FORMAT NLS_LANG='ITALIAN_ITALY.WE8ISO8859P15' ; export NLS_LANG rman target / nocatalog log /tmp/rman_${ORACLE_SID}.log << EOF CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/tmp/snapcf_${ORACLE_SID}.f'; CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/asigra/libdsc_ora_sbt_Linux_x86_64.so,ENV=(CONNECT_INFO=/asigra/parms.txt)'; CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE'; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 22 DAYS; crosscheck archivelog all; crosscheck backup device type sbt; backup as compressed backupset archivelog all not backed up 1 times format 'ora.%d.%s.%p.%t.%u.arc.rman' filesperset 20 delete all input; delete noprompt archivelog all backed up 1 times to device type sbt; backup as compressed backupset ${LEVEL} tag ${TAG} ${KEEP} database format 'ora.%d.%s.%p.%t.%u.rman' filesperset 20 plus archivelog not backed up 1 times format 'ora.%d.%s.%p.%t.%u.arc.rman' filesperset 20 delete all input; #delete noprompt archivelog until time 'sysdate -1' backed up 1 times to device type sbt; delete noprompt obsolete device type sbt; delete noprompt expired backup device type sbt; ALLOCATE CHANNEL FOR MAINTENANCE TYPE DISK; CROSSCHECK BACKUP DEVICE TYPE DISK; #CROSSCHECK DATAFILECOPY ALL; #DELETE NOPROMPT EXPIRED DATAFILECOPY ALL; DELETE NOPROMPT OBSOLETE DEVICE TYPE DISK; DELETE NOPROMPT EXPIRED BACKUP DEVICE TYPE DISK; RELEASE CHANNEL; EOF