Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
rem
rem rmanARCH.cmd
rem
rem %1% is the ORACLE_SID
rem
set NLS_DATE_FORMAT=YYYY-MM-DD-HH24:MI:SS
set NLS_LANG=AMERICAN_AMERICA
set ORACLE_SID=%1%
set BACKUP_DIR=E:\BACKUP

rem
rem Do the backup and save the result status from RMAN
rem
rman cmdfile=rmanARCH.rcv log=rmanARCH_%ORACLE_SID%.log
set RMANRC=%ERRORLEVEL%
sqlplus monitor/******** @rman_report %RMANRC% ARCH <Customer>

RMAN command file for full backup

RMAN command file for archive backup

Code Block

#
# rmanARCH.rcv
#
connect target /
run {
	configure retention policy to redundancy 1;
	configure controlfile autobackup off;
#
# Backup the control file and spfile to create a valid restore point
#
	allocate channel d1 type disk maxpiecesize 2G;
	backup
		as compressed backupset
		incremental level 0
		format 'E:\Backup\%d\%T-CTRL-%s-%p.dmp'
		current controlfile
		spfile
		skip inaccessible
		skip readonly;
	release channel d1;
#
# Backup all the existing archive log files
#
	allocate channel d1 type disk maxpiecesize 2G;
	sql 'alter system archive log current';
	backup
		as compressed backupset
		format 'E:\Backup\%d\%T-ARCH-%s-%p.dmp'
		skip inaccessible
		archivelog all delete all input;
		
	release channel d1;
}
#
# Report and delete any obsolete backupsets
#
report obsolete;
delete force noprompt obsolete;
#
# Crosscheck the backup files for existence
#
allocate channel for maintenance type disk;
crosscheck backup;
release channel;
#
# Delete entries for non-existing backupset to remove the clutter
#
allocate channel for delete type disk;
delete force noprompt expired backup;
release channel;