Rman backup method-Incremental backup and rman backup method incremental
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;
How does rman restore Incremental backup?
First, you must have a backup of level 0. Otherwise, no matter how many incremental backups are set, the backup of level 0 is returned by default.
Syntax:
Backup incremental level x database;
What is the default value of rman Incremental backup? Is incremental by default or incremental by accumulation? What are their advantages and disadvantages?
The cumulative incremental backup time of rman is long and the recovery time is short. Differential Incremental backup time period, long recovery time.