[Rman, 1] Typical Incremental Backup case

Source: Internet
Author: User
I. backup policy: 1. sunday evening-level0backup0000med (full backup) 2. monday evening-level2backupdomainmed3. tuesday evening-level2backupdomainmed4. thursday evening-level1backupdomainmed5. thursday evening-level2backupdomainmed6. friday evening-level2b

I. backup policy: 1. sunday evening-level 0 backup completed MED (full backup) 2. monday evening-level 2 backup completed MED 3. tuesday evening-level 2 backup completed MED 4. wednesday evening-level 1 backup completed MED 5. thursday evening-level 2 backup completed MED 6. friday evening-level 2 B

I. Backup policy:

1. sunday evening-level 0 backup completed MED (full backup) 2. monday evening-level 2 backup completed MED 3. tuesday evening-level 2 backup completed MED 4. wednesday evening-level 1 backup completed MED 5. thursday evening-level 2 backup completed MED 6. friday evening-level 2 backup completed MED 7. saturday evening-level 2 backup saved med if you want to recover on Tuesday, you only need 1 + 2. If you want to recover on Thursday, you only need 1 + 4. If you want to recover on Friday, only 1 + 4 + 5 is required. If recovery is required on Saturday, only 1 + 4 + 5 + 6 is required. automatic Backup: backup script + crontab bakl0 bakl1 bakl2

Ii. executed script:

1. Execute the script:

Rman target/msglog = bakl0.log prepare file = bakl0 (/indicates the target database to be connected, msglog indicates the log file, and audit file indicates the script file) rman target/msglog = bakl1.log prepare file = bakl1 rman target/msglog = bakl2.log prepare file = bakl2 instance: rman target system/oracle @ ora10g (/) msglog =/u01/rmanbak/bakl1.log prepare file =/u01/rmanbak/bakl0
Complete command:/u01/oracle/product/10.2.0/bin/rman target system/oracle @ ora10g (/) msglog =/u01/rmanbak/bakl1.log prepare file =/u01/rmanbak/bakl0

2. Compile the rman backup script: Level 0 backup script:

Put the backup script under the/u01/rmanbak/script directory. The contents of vi bakl0 and bakl0 are run {allocate channel cha1 type disk; backup incremental level 0 format'/home/oracle/rmanbackup/inc0 _ % u _ % t) tag monday_inc0 // tag can start by the way. It doesn't matter if database plus archivelog delete input; release channel cha1;} level 1 backup script: run {allocate channel cha1 type disk; backup incremental level 1 format'/home/oracle/rmanbackup/inc1 _ % u _ % t) tag monday_inc1 // tag can be started by the way, it doesn't matter database plus archivelog delete input; release channel cha1 ;}
Level 2 backup script: run {allocate channel cha1 type disk; backup incremental level 2 format'/home/oracle/rmanbackup/inc2 _ % u _ % t) tag monday_inc2 // tag can be started by the way, it doesn't matter database plus archivelog delete input; release channel cha1 ;}

3. Compile the shell script that calls the rman script:

The shell script rmanbak0.sh for calling 0 backup is :#! /Bin/bash source/home/oracle /. bash_profile/u01/app/oracle/11.2.0/db_home_1/bin/rman target/nocatalog export file =/home/oracle/script/bakl0 msglog =/home/oracle/bakl0.log
The shell script rmanbak0.sh for calling 1 backup is :#! /Bin/bash source/home/oracle /. bash_profile/u01/app/oracle/11.2.0/db_home_1/bin/rman target/nocatalog cmdfile =/home/oracle/script/bakl1 msglog =/home/oracle/bakl0.log call 2 backup the shell script rmanbak0.sh is: #! /Bin/bash source/home/oracle /. bash_profile/u01/app/oracle/11.2.0/db_home_1/bin/rman target/nocatalog export file =/home/oracle/script/bakl2 msglog =/home/oracle/bakl0.log

4. Compile a Linux scheduled task to perform automatic backup

[Root @ gc2 ~] # Crontab-e-u oracle (this command indicates editing the scheduled execution of oracle users (-e, edit-u oracle, oracle users )) week (0 represents Sunday) 45 23 ** 0/home/oracle/script/rmanbak0.sh (commands are executed as oracle users at on Sunday) 45 23 ** 1/home/oracle/script/rmanbak2.sh 45 23 ** 2/home/oracle/script/rmanbak2.sh 45 23 ** 3/home/oracle/script/rmanbak1.sh 45 23 ** 4/home/oracle/script/rmanbak2.sh 45 23 ** 5/home/oracle/script/rmanbak2.sh45 23 ** 6/home/oracle/script/rmanbak2.sh

Or (for testing): use an oracle user to add a routine task: crontab-e to add the following content in the new window: 0 24 ***/home/oracle/bin/rmanbak0.sh (*/3 *****/home/oracle/bin/rmanbak0.sh) note, the brackets can be used for testing. A backup is performed every three minutes. For example, a backup is performed every 24 o'clock every day.
# Then start crontab and start the crontab command: [root @ gc2 ~] # Service crond restart Stopping crond: [OK] Starting crond: [OK] # monitor whether a scheduled task is executed [root @ gc2 ~] # Tail-f/var/log/cron
Mar 10 21:28:04 gc2 crond [4435]: (CRON) STARTUP (V5.0) Mar 10 21:30:01 gc2 crond [4445]: (root) CMD (/usr/lib/sa/sa1 1) Mar 10 21:39:08 gc2 crond [4486]: (CRON) STARTUP (V5.0)

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.