RMAN backup method-Incremental Backup

Source: Internet
Author: User

Usage type: the system load is concentrated in a certain period of time, such as 8 hours during the day, and is usually idle at night. Therefore, data can be backed up at night.

It corresponds to full-Database Backup:

Http://blog.csdn.net/jacson_bai/article/details/39636915

1. env:
IP Address: 10.244.171.180/181
Oracle Database Oracle 11.2.0.3
OS RHEL 5.5
Backup toos: rman, Shell, crontab

2. Backup Plan (incremental Plan)
Sunday: Execute level 0 incremental back
Monday: Execute Level 2 incremental back
Tuesday: Execute Level 2 incremental back
Wednesday: Execute Level 1 incremental back
Thursday: Execute Level 2 incremental back
Friday: Execute Level 2 incremental back
Saturday: Execute Level 2 incremental back

3. Plan the Backup Directory in node2
-- Create a directory to save the backup script
$ Mkdir-P/data/scripts/RMAN/
-- Create a directory for backup data
$ Mkdir-P/data/rmandata/-- stores the backup data directory

3. Create *. SQL and rman_backup.sh scripts.

-- Full backup lv0:
$ CD/data/scripts/RMAN/
$ VI backup_lv0. SQL
Run {
Allocate channel C1 type disk;
Allocate channel C2 type disk;
Allocate channel C3 type disk;
Allocate channel C4 type disk;
Backup incremental level 0 Database
Include current controlfile format '/data/rmandata/backup _ % T _ % S _ % u _ % T. lv0'
Plus archivelog delete all input format'/data/ARCH/backup _ % T _ % S _ % P _ % T. arc ';
Release Channel C1;
Release Channel C2;
Release Channel C3;
Release Channel C4;
}
-- Incremental Backup LV1:
VI backup_lv1. SQL
Run {
Allocate channel C1 type disk;
Backup incremental Level 1 database include current controlfile
Format '/data/rmandata/backup _ % T _ % S _ % P. lv1 ';
Release Channel C1;
}
-- Accumulative lv2 backup:
$ VI backup_lv2. SQL
Run {
Allocate channel C1 type disk;
Backup incremental Level 2 database include current controlfile
Format '/data/rmandata/backup _ % T _ % S _ % P. lv2 ';
Release Channel C1;
}

4. Write shell scripts
-- Functions to be implemented by the script:
1. correctly determine the week
2. Record the running time of each RMAN backup

#! /Bin/bash
Source/home/Oracle/. bash_profile
Myweek = 'date + %'
Mydate = 'date + % Y % m % d'
Mydir =/data/
# Monday
If ["$ myweek" = "mon"]; then
RMAN target sys/Oracle msglog =$ {mydir}/backup _ $ {mydate}. Log partition file =$ {mydir}/scripts/RMAN/backup_lv2. SQL
Fi
# Tuesday
If ["$ myweek" = "Tue"]; then
RMAN target sys/Oracle msglog =$ {mydir}/backup _ $ {mydate}. Log partition file =$ {mydir}/scripts/RMAN/backup_lv2. SQL
Fi
# Wednesday
If ["$ myweek" = "wed"]; then
RMAN target sys/Oracle msglog =$ {mydir}/backup _ $ {mydate}. Log partition file =$ {mydir}/scripts/RMAN/backup_lv1. SQL
Fi
# Thursday
If ["$ myweek" = "Thu"]; then
RMAN target sys/Oracle msglog =$ {mydir}/backup _ $ {mydate}. Log partition file =$ {mydir}/scripts/RMAN/backup_lv2. SQL
Fi
# Friday
If ["$ myweek" = "fri"]; then
RMAN target sys/Oracle msglog =$ {mydir}/backup _ $ {mydate}. Log partition file =$ {mydir}/scripts/RMAN/backup_lv2. SQL
Fi
# Saturday
If ["$ myweek" = "sat"]; then
RMAN target sys/Oracle msglog =$ {mydir}/backup _ $ {mydate}. Log partition file =$ {mydir}/scripts/RMAN/backup_lv2. SQL
Fi
# Sunday
If ["$ myweek" = "sun"]; then
RMAN target sys/Oracle msglog =$ {mydir}/backup _ $ {mydate}. Log partition file =$ {mydir}/scripts/RMAN/backup_lv0. SQL
Fi

5. Specify the crontab script
$ Crontab-e
30 20 *** sh/data/script/RMAN/rman_backup.sh;

 

RMAN backup method-Incremental Backup

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.