[Rman] Oracle Rman Incremental backup Level012 script ____oracle

Source: Internet
Author: User

http://blog.csdn.net/u011364306/article/details/50036429 of Rman Level012 Backup experiment


With a 0221222 incremental backup strategy, 7 days a cycle

That is, Sunday level 0 backup, Week 1 2 4 5 6 using 2 level incremental backup, week 3 with 1 level incremental backup

Open Control File Automatic backup

CONFIGURE Controlfile autobackup on;

11g control file Automatic backup new features: http://blog.csdn.net/u011364306/article/details/50051303


Configure control file backup path

RMAN > CONFIGURE controlfile autobackup FORMAT for DEVICE TYPE DISK to '/file/backup/rman/controlfile_%f ';
Set expiration days to 7 days
Rman> CONFIGURE RETENTION POLICY to RECOVERY windows of 7 days;

Data backup Directory

$ mkdir-p/file/backup/rman/

Script Explanation:

Vim rman_bak_level0.sh   
#!/bin/bash 
export oracle_base=/u01/oracle
export oracle_home= $ORACLE _base/ Product/11.2.0/db_1
Export path= $ORACLE _home/bin: $PATH
Export oracle_sid=neal-    -Database Oracle_sid
Export nls_lang= ' American_america. ZHS16GBK '   --character Set
Rman target/<<eof  
run{  
Allocate channel D1 type disk;   --Allocate channel D1, type Backup to disk
allocate channel d2 type disk;   --Allocate channel D2, type backup to disk backup
incremental level 0 database format '/FILE/BACKUP/RMAN/LEVEL0_%D_%S_%P_%U.BKP ';   --backup level, output format, path
SQL ' alter system archive log current ';    --Archive The current redo log
backup archivelog all Delete input format '/FILE/BACKUP/RMAN/ARCHIVELOG_%D_%S_%P_%U.BKP ';  --Back up the archive log and delete
crosscheck backup;   --Check backup
delete noprompt obsolete;  --Silently Delete expired backup release
channel D1;  --Releasing channel D1 release
channel D2;  --Release channel D2
}  

Below, start creating level 0 Level 1 level 2 backup scripts

Level 0 Backup Script

Vim rman_bak_level0.sh
#!/bin/bash
export oracle_base=/u01/oracle
export oracle_home= $ORACLE _base/ Product/11.2.0/db_1
Export path= $ORACLE _home/bin: $PATH
export oracle_sid=neal
export nls_lang= ' American_america. ZHS16GBK '
rman target/<<eof
run{
Allocate channel D1 type disk;
Allocate channel D2 type disk;
Backup incremental Level 0 database format '/FILE/BACKUP/RMAN/LEVEL0_%D_%S_%P_%U.BKP ';
SQL ' alter system archive log current ';
Backup Archivelog All Delete input format '/FILE/BACKUP/RMAN/ARCHIVELOG_%D_%S_%P_%U.BKP ';
Crosscheck backup;
Delete noprompt obsolete;
Release channel D1;
Release channel D2;
}
Eof

Level 1 Backup Script

Vim rman_bak_level1.sh
#!/bin/bash
export oracle_base=/u01/oracle
export oracle_home= $ORACLE _base/ Product/11.2.0/db_1
Export path= $ORACLE _home/bin: $PATH
export oracle_sid=neal
export nls_lang= ' American_america. ZHS16GBK '
rman target/<<eof
run{
Allocate channel D1 type disk;
Allocate channel D2 type disk;
Backup incremental Level 1 database format '/FILE/BACKUP/RMAN/LEVEL1_%D_%S_%P_%U.BKP ';
SQL ' alter system archive log current ';
Backup Archivelog All Delete input format '/FILE/BACKUP/RMAN/ARCHIVELOG_%D_%S_%P_%U.BKP ';
Crosscheck backup;
Delete noprompt obsolete;
Release channel D1;
Release channel D2;
}
Eof
Level 2 Backup Script

Vim rman_bak_level2.sh
#!/bin/bash
export oracle_sid=neal
export nls_lang= ' American_america. ZHS16GBK '
/u01/oracle/product/11.2.0/db_1/bin/rman target/<<eof
run{
allocate channel D1 type disk;
Allocate channel D2 type disk;
Backup incremental Level 2 database format '/FILE/BACKUP/RMAN/LEVEL2_%D_%S_%P_%U.BKP ';
SQL ' alter system archive log current ';
Backup Archivelog All Delete input format '/FILE/BACKUP/RMAN/ARCHIVELOG_%D_%S_%P_%U.BKP ';
Crosscheck backup;
Delete noprompt obsolete;
Release channel D1;
Release channel D2;
}
Eof
Join in the Crontab
CRONTAB-E
#周日0级备份
* * 0/server/scripts/rman_bak_level0.sh
#周一, two, four or five, 62 incremental backups
00 23 * * 1,2,4,5,6/server/scripts/rman_bak_level2.sh
#周三1级增量备份
* * 3/server/scripts/rman_bak_level1.sh

Meaning of variables in Rman backup

Backup Incremental Level 0 database format= ' lev0_%d_%t_%u_%s_%p '  
format=string A format string of file paths and names, which can contain macro variables:
%c Copy ID
%p backup piece ID
%s backup set ID
%e log sequence
%h log thread ID
%d database name
% n Database name (x fills to 8 characters)
%I DBID
%f file ID
%f DBID, day, month, year, and sequencer composite
%N tablespace name
%t timestamp
%m MH mm format
%Y Year yyyy format
%u backup set+time ((x fills to 8 characters)
%u%u_%p_%c
percent%
The format specifier%u is replaced wit H Unique filenames for the "files" when you take backups.
The%F element of the format string combines the DBID, day, month, year, and sequence number to generate a unique Fil Ename. %F must is included in the any control file Autobackup format.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.