Versions Compared

Key

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

...

RMAN command file for full backup

RMAN command file for archive backup

Code Block
#
# rmanARCHrmanFULL.rcv
#
connect target /
run {
	configure retention policy to redundancy 1;
	configure controlfile autobackup off;
#
# Backup all the control file and spfile to create a valid restore point 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;