Oracle Rman Incremental Backup script

Source: Internet
Author: User

With 0112111 incremental backup strategy, 7 days a cycle that is, Sunday level 0 backup, Week 1 2 4 5 6 with 2-level incremental backup, week 3 with 1-level incremental backup

Configure control file backup path
    1. RMAN > CONFIGURE controlfile autobackup FORMAT for DEVICE TYPE DISK to '/u01/backup/rmanbk/ccontrolfile_%f ';
Data Backup directory
    1. $ mkdir-p/U01/BACKUP/RMANBK
First set the number of days to expire to 7 days
    1. Rman> CONFIGURE RETENTION POLICY to RECOVERY windows of 7 days;
Start creating Level 0 1 Level 2 backup scripts below

Level 0 Backup Script
    1. Vim rman_bk_level0.sh
    2. ------Level 0 Backup----------------
    3. #! /bin/bash
    4. Export ORACLE_SID=ORCL
    5. Export nls_lang= ' American_america. ZHS16GBK '
    6. /u01/app/oracle/11.2.0/dbhome_1/bin/rman Target/<<eof
    7. run{
    8. Allocate channel D1 type disk;
    9. Allocate channel D2 type disk;
    10. Backup incremental Level 0 database format '/U01/BACKUP/RMANBK/LEVEL0_%D_%S_%P_%U.BKP ';
    11. SQL ' alter system archive log current ';
    12. Backup Archivelog All Delete input format '/U01/BACKUP/RMANBK/LOG_%D_%S_%P_U%.BKP ';
    13. }
    14. Crosscheck backup;
    15. Delete NoPrompt obsolete;
    16. Exit
    17. <<eof
    18. ------------------

Level 1 Backup Script
    1. Vim rman_bk_level1.sh
    2. ---------Level 1 Incremental backup---------------
    3. #! /bin/bash
    4. Export ORACLE_SID=ORCL
    5. Export nls_lang= ' American_america. ZHS16GBK '
    6. /u01/app/oracle/11.2.0/dbhome_1/bin/rman Target/<<eof
    7. run{
    8. Allocate channel D1 type disk;
    9. Allocate channel D2 type disk;
    10. Backup incremental Level 1 database format '/U01/BACKUP/RMANBK/LEVEL1_%D_%S_%P_%U.BKP ';
    11. SQL ' alter system archive log current ';
    12. Backup Archivelog All Delete input format '/U01/BACKUP/RMANBK/LOG_%D_%S_%P_U%.BKP ';
    13. }
    14. Crosscheck backup;
    15. Delete NoPrompt obsolete;
    16. Exit
    17. <<eof
Level 2 backup script
    1. Vim rman_bk_level2.sh
    2. ---------Level 2 Incremental backup---------------
    3. #! /bin/bash
    4. Export ORACLE_SID=ORCL
    5. Export nls_lang= ' American_america. ZHS16GBK '
    6. /u01/app/oracle/11.2.0/dbhome_1/bin/rman Target/<<eof
    7. run{
    8. Allocate channel D1 type disk;
    9. Allocate channel D2 type disk;
    10. Backup incremental Level 2 database format '/U01/BACKUP/RMANBK/LEVEL2_%D_%S_%P_%U.BKP ';
    11. SQL ' alter system archive log current ';
    12. Backup Archivelog All Delete input format '/U01/BACKUP/RMANBK/LOG_%D_%S_%P_U%.BKP ';
    13. }
    14. Crosscheck backup;
    15. Delete NoPrompt obsolete;
    16. Release D1;
    17. Exit
    18. <<eof

Add to Crontab
    1. Crontab-e
    2. -----------
    3. #周日0级备份
    4. XX * * 0/u01/backup_shell/rman_bk_level0.sh
    5. #周一, second, four or five, level 62 incremental backups
    6. XX * * 1,2,4,5,6/u01/backup_shell/rman_bk_level2.sh
    7. #周三1级增量备份
    8. XX * * 3/u01/backup_shell/rman_bk_level1.sh

Oracle Rman Incremental Backup script

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.