Regardless of the platform, we must first clarify our goals:
1) execute at every night
2) Full backup of the database, backup control files and archive log files at the same time, and save the backup files to the/u01/app/Oracle/backup/directory. After archiving the log files, automatically delete archived logs that have been backed up
3) The backup is retained for 14 days and automatically deleted upon expiration.
4) Retain rman operation logs
First, implement it on the window Platform
Compile the rman batch file
- Run {
- Configure retention policyToRecovery windowOf14 days;
- Configure controlfile autobackupOn;
- Configure controlfile autobackup formatForDevice type diskTo '/U01/app/oracle/backup/% F';
- Allocate channel c1 device type disk format'/U01/app/oracle/backup/bak _ % U';
- BackupDatabaseSkip inaccessible plus archivelog filesperset 20Delete AllInput;
- Release channel c1;
- }
- Crosscheck backupset;
- DeleteNoprompt obsolete;
Save to D: \ oracle \ script \ backup \ db_fullbak_think.rman
Note: skip inaccessible: skip unreadable files
Skip offline: skip offline files
Skip readonly: Skips read-only data files.
Filesperset: specifies the maximum number of files that can be contained in each type of backup set. In this example, filesperset appears in the backup archiving clause. Therefore, it is used to limit that each archive backup set can contain up to 20 archive files.
Write commands to execute rman batch processing files
- SetORACLE_SID = orcl
- Rman target/log d: \ oracle \ script \ backup \ logs \ bak _ %DATE:~ 0, 10%. LOG partition file = D: \ oracle \ script \ backup \ db_fullbak_think.rman
Save the preceding content to D: \ oracle \ script \ backup \ db_fullbak_think.bat.
Set execution plan
Open Control Panel ---> Task Scheduler --> Add Task Scheduler
* ****************************** The linux platform is as follows ****** ***************************
In fact, there is little difference between Windows and linux's automatic rman backup, and there is no need to change the rman batch processing script much. The only difference is that crontab is used for automatic backup in linux.
In crontab:
- ORACLE_HOME =/u01/app/oracle/product/10.2.0/db_1
- ORACLE_BASE =/u01/app/oracle
- ORACLE_SID = orcl
- * ***/U01/app/oracle/product/10.2.0/db_1/bin/rman target/partition file = '/home/oracle/rmanbackupusers. rcv'
For the use of crontab, see: Linux cron Learning System