1. Log On As an Oracle user
2. Compile an automatic backup script and clear the archived logs.
$ Vi/home/oracle/backs. sh
#! /Bin/sh
Source/home/oracle/. bash_profile
Cd $ ORACLE_HOME/bin
Rman target/nocatalog msglog =/home/oracle/rman_bk _ 'date' + % Y % m % d % H % M % s'. log <EOF
Run {
Report obsolete;
DELETE force noprompt obsolete;
Allocate channel c1 type disk;
Allocate channel c2 type disk;
Allocate channel c3 type disk;
Backup incremental level = 0 database tag 'level0' format'/home/oracle/dblevel0 _ % s _ % T ';
Backup current controlfile tag 'ctl 'format'/home/oracle/ctl _ % s _ % p _ % T ';
SQL 'alter system archive log current ';
Crosscheck archivelog all;
Backup filesperset 3 archivelog all tag 'arch 'format'/home/oracle/oarch _ % u _ % s _ % P' delete input;
Release channel c1;
Release channel c2;
Release channel c3;
}
Exit;
EOF
Note:
The last format of the log file name is bk _ year, month, hour, minute, second. log
Rman_bk_20120102101501.log
ID of the % s backup set
% T backup set Timestamp
% T year month day format (YYYYMMDD)
3. Set RMAN to automatically run the script for saving the database
Vi/home/oracle/runback. sh
#! /Bin/sh
Source/home/oracle/backs. sh
4. Set the script execution time for automatic RMAN backup. The time here is every day.
Crontab-e
3 10 ***/home/oracle/runback. sh