Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

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

Code Block

#
# rmanFULL.rcv
#
connect target /
run {
	configure retention policy to redundancy 1;
	configure controlfile autobackup off;
#
# Backup all the datafile that are not read only
#
	allocate channel d1 type disk maxpiecesize 2G;
	backup
		as compressed backupset
		incremental level 0
		format 'E:\BACKUP\%d\%T-FULL-%s-%p.dmp'
		database
		skip inaccessible
		skip readonly;
	release channel d1;
#
# Backup all the existing archive log files
#
	sql 'alter system archive log current';
	allocate channel d1 type disk maxpiecesize 2G;
	backup
		as compressed backupset
		format 'E:\BACKUP\%d\%T-ARCH-%s-%p.dmp'
		skip inaccessible
		archivelog all delete all input;
		
	release channel d1;
#
# 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;
}
#
# 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;

RMAN command file for archive backup

Code Block

#
# rmanARCH.rcv
#
connect target /
run {
	configure retention policy to redundancy 1;
	configure controlfile autobackup off;
#
# Backup all the existing archive log files
#
	sql 'alter system archive log current';
	allocate channel d1 type disk maxpiecesize 2G;
	backup
		as compressed backupset
		format 'E:\BACKUP\%d\%T-ARCH-%s-%p.dmp'
		skip inaccessible
		archivelog all delete all input;

	release channel d1;
#
# 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;
}
#
# 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;