RMAN full backup script
Objectives:
1. the backup script is automatically executed at midnight every week.
2. Full database backup, control files and archive log files are backed up at the same time.
3. the backup is retained for 14 days and automatically deleted upon expiration.
4. Retain operation logs for future reference.
(1) Compile the RMAN batch processing file: rman automatic backup script (oraback0.sh)
Run {
Configure retention policy to recovery windown of 14 DAYS;
Cofnigure controlfile autoback on;
Configure controlfile autobackup format for device type disk to '/Oracle/oradata/backup/rmanback/% F ';
Allocate channel C1 device type disk format'/oracle/oradata/backup/rmanback/orabk0 _ % d _ % T _ % s ';
BACKUP DATABASE SKIP INACCESSIBLE
Plus archivelog filesperset 20
Delete all input;
Release channel C1;
}
Allocate channel for maintenance device type disk;
Crosscheck backupset;
Delete noprompt obsolete;
Supplement:
Backup skip parameters:
Skip inaccessible: Indicates skipping unreadable files. OFFLINE files can still be read as long as they exist on the disk, but some files have been deleted or moved and cannot be read. With this parameter, these files will be skipped.
Skip offline: indicates that OFFLINE data files are skipped.
Skip readonly: skips the data file whose tablespace is READONLY.
Allocate channle for maintenacne device type disk; is used to ALLOCATE commands dedicated to CHANGE, DELETE, and CROSSCHECK, and cannot be included in the RUN block.
By default, CONFIGURE has configured a channel FOR the specified DISK. Therefore, you can also choose not to execute allocate channle for maintenacne. In addition, oracle also recommends using CONFIGURE.
To configure the channel.
(2) Compile the execution script run_rman_backup.sh.
ORACLE_SID = test
ORACLE_BASE =/oracle
ORACLE_HOME = $ ORACLE_BASE/product/11.1.0/db_1
Export ORACLE_SID ORACLE_BASE ORACLE_HOME
Export ORA_NLS10 = $ ORACLE_HOME/nls/data
PATH = $ PATH: $ ORACLE_HOME/bin: $ HOME/bin
LD_LIBRARY_PATH = $ ORACLE_HOME/lib:/usr/lib;
Export PATH
$ ORACLE_HOME/bin/rman target/msglog =/backup/oraclebaklog/bak. log partition file =/backup/shell/oraback0.sh
(3) join the execution plan
Crontab-e
00 03 ** 0/backup/shell/run_rman_back.sh
Note: The corresponding directory should be created, and the corresponding file should be placed in the corresponding directory.
-------------------------------------- Recommended reading --------------------------------------
RMAN: Configure an archive log deletion policy
Basic Oracle tutorial-copying a database through RMAN
Reference for RMAN backup policy formulation
RMAN backup learning notes
Oracle Database Backup encryption RMAN Encryption
-------------------------------------- Split line --------------------------------------