The RMAN backup script in Windows is relatively simple. Let's look at the content.
1.ModifyRMANRelated Parameters
RMAN> show all;
RMAN> Configure controlfile autobackup on;
RMAN> Configure controlfile autobackup format for device type disk to 'd:/backup/% F ';
RMAN> exit;
After setting the parameters as above, the control file and spfile will be automatically backed up to D:/backup along with the database backup;
2.Backup script
The content of rmanbackup.txt is as follows:
Run {
Allocate channel C1 type disk;
Backup database format 'd:/hotback/DB _ % U' plus archivelog delete all input format 'd:/hotback/arch _ % U ';
Release Channel C1;
}
Exit
The rmanbackup. BAT file contains the following content:
RMAN target sys/admin @ DBA nocatalog cmdfile 'd:/rmanbackup.txt'
Log 'd:/rman_backup _ % Date :~ 0, 4% % Date :~ 5, 2% % Date :~ 8, 2% ". Log'
Add the rmanbackup. BAT file to the scheduled task for regular execution. After the backup is complete, a log file in the format of rman_backup_20100112.log is generated in the same directory.