RMAN一周典型备份方案(RMAN one week typical backup scheme)

RMAN一周典型备份方案

wx5caecf2ed0645 2021-08-10 09:59:03 博主文章分类:Oracle

文章标签 oracle 备份文件 自动备份 编程 文章分类 IT业界 其它 阅读数7

==================  RMAN一周典型备份方案 ===============

1.星期天晚上      -level 0 backup (全备份)

2.星期一晚上      -level 2 backup 

3.星期二晚上      -level 2 backup 

4.星期三晚上      -level 1 backup 

5.星期四晚上      -level 2 backup 

6.星期五晚上      -level 2 backup 

7.星期六晚上      -level 2 backup 

如果星期二需要恢复的话,只需要1+2,

如果星期四需要恢复的话,只需要1+4,

如果星期五需要恢复的话,只需要1+4+5,

如果星期六需要恢复的话,只需要1+4+5+6.

自动备份:备份脚本+crontab

 bakl0

 bakl1

 bakl2

配置:

1: mkdir -p /u01/app/oracle/rmanbak/scripts/   (放备份脚本目录)

2: mkdir -p /u01/app/oracle/rmanbak/logs/      (放日志目录)

3: mkdir -p /u01/app/oracle/rmanbak/bak/       (放备份文件的目录)

4: crontab -e -u root

          30 23 * * 0 /u01/app/oracle/rmanbak/scripts/bakl0

          30 23 * * 0 /u01/app/oracle/rmanbak/scripts/bakl2

          30 23 * * 0 /u01/app/oracle/rmanbak/scripts/bakl2

          30 23 * * 0 /u01/app/oracle/rmanbak/scripts/bakl1

          30 23 * * 0 /u01/app/oracle/rmanbak/scripts/bakl2

          30 23 * * 0 /u01/app/oracle/rmanbak/scripts/bakl2

          30 23 * * 0 /u01/app/oracle/rmanbak/scripts/bakl2

5: service crond restart

6: 附件

   ——————-bakl0脚本——————

      #!/bin/sh

      cd /u01/app/oracle/rmanbak/scripts

      su – oracle -c “rman target / msglog=/u01/app/oracle/rmanbak/logs/bakl0.log < /u01/app/oracle/rmanbak/scripts/bakl0.bak”

   ——————-bakl0.bak脚本————–

   run {

    allocate channel c1 device type disk;

    allocate channel c2 device type disk;

    allocate channel c3 device type disk;

    allocate channel c4 device type disk;

    backup incremental level 0 format ‘/u01/app/oracle/rmanbak/bak/inc0_%u_%T’ tag sunday_inc0 database;

    release channel c1;

    release channel c2;

    release channel c3;

    release channel c4;

   }

   ——————-bakl1脚本——————

       #!/bin/sh

      cd /u01/app/oracle/rmanbak/scripts

      su – oracle -c “rman target / msglog=/u01/app/oracle/rmanbak/logs/bakl1.log < /u01/app/oracle/rmanbak/scripts/bakl1.bak”

   ——————-bakl1.bak脚本————–

   run {

    allocate channel c1 device type disk;

    allocate channel c2 device type disk;

    allocate channel c3 device type disk;

    allocate channel c4 device type disk;

    backup incremental level 1 format ‘/u01/app/oracle/rmanbak/bak/inc1_%u_%T’ tag inc1 database;

    release channel c1;

    release channel c2;

    release channel c3;

    release channel c4;

   }

   ——————-bakl2脚本——————

        #!/bin/sh

        cd /u01/app/oracle/rmanbak/scripts

      su – oracle -c “rman target / msglog=/u01/app/oracle/rmanbak/logs/bakl2.log < /u01/app/oracle/rmanbak/scripts/bakl2.bak”

   ——————-bakl2.bak脚本————–

   run {

    allocate channel c1 device type disk;

    allocate channel c2 device type disk;

    allocate channel c3 device type disk;

    allocate channel c4 device type disk;

    backup incremental level 2 format ‘/u01/app/oracle/rmanbak/bak/inc2_%u_%T’ tag inc2 database;

    release channel c1;

    release channel c2;

    release channel c3;

    release channel c4;

   }

————————

RMAN one week typical backup scheme

Wx5caecf2ed0645 2021-08-10 09:59:03 blogger article classification: Oracle

< strong class = "FL" > Article label Oracle backup file automatic backup programming < / strong > < strong class = "FL" > Article classification other in the IT industry < / strong > < strong class = "FL" > reading < strong class = "FL" > 7 < / strong > < / strong >

==================RMAN one week typical backup scheme===============

1. Sunday night – level 0 backup (full backup)

2. Monday night – level 2 backup

3. Tuesday night – level 2 backup

4. Wednesday night – level 1 backup

5. Thursday night – level 2 backup

6. Friday night – level 2 backup

7. Saturday night – level 2 backup

If you need to recover on Tuesday, you only need 1 + 2,

If you need to recover on Thursday, you only need 1 + 4,

If you need to recover on Friday, you only need 1 + 4 + 5,

If you need to recover on Saturday, you only need 1 + 4 + 5 + 6

Automatic backup: backup script + crontab

 bakl0

 bakl1

 bakl2

to configure:

1: MKDIR – P / u01 / APP / Oracle / rmanbak / scripts / (directory for backup scripts)

2: MKDIR – P / u01 / APP / Oracle / rmanbak / logs / (log directory)

3: MKDIR – P / u01 / APP / Oracle / rmanbak / bak / (directory for backup files)

4: crontab -e -u root

          30 23 * * 0 /u01/app/oracle/rmanbak/scripts/bakl0

          30 23 * * 0 /u01/app/oracle/rmanbak/scripts/bakl2

          30 23 * * 0 /u01/app/oracle/rmanbak/scripts/bakl2

          30 23 * * 0 /u01/app/oracle/rmanbak/scripts/bakl1

          30 23 * * 0 /u01/app/oracle/rmanbak/scripts/bakl2

          30 23 * * 0 /u01/app/oracle/rmanbak/scripts/bakl2

          30 23 * * 0 /u01/app/oracle/rmanbak/scripts/bakl2

5: service crond restart

6: Attachment

—————— bakl0 script——————

#!/ bin/sh

      cd /u01/app/oracle/rmanbak/scripts

      su – oracle -c “rman target / msglog=/u01/app/oracle/rmanbak/logs/bakl0.log < /u01/app/oracle/rmanbak/scripts/bakl0.bak”

——————-bakl0. Bak script————–

run {

    allocate channel c1 device type disk;

    allocate channel c2 device type disk;

    allocate channel c3 device type disk;

    allocate channel c4 device type disk;

    backup incremental level 0 format ‘/u01/app/oracle/rmanbak/bak/inc0_%u_%T’ tag sunday_inc0 database;

    release channel c1;

    release channel c2;

    release channel c3;

    release channel c4;

}

—————— bakl1 script——————

#!/ bin/sh

      cd /u01/app/oracle/rmanbak/scripts

      su – oracle -c “rman target / msglog=/u01/app/oracle/rmanbak/logs/bakl1.log < /u01/app/oracle/rmanbak/scripts/bakl1.bak”

——————-bakl1. Bak script————–

run {

    allocate channel c1 device type disk;

    allocate channel c2 device type disk;

    allocate channel c3 device type disk;

    allocate channel c4 device type disk;

    backup incremental level 1 format ‘/u01/app/oracle/rmanbak/bak/inc1_%u_%T’ tag inc1 database;

    release channel c1;

    release channel c2;

    release channel c3;

    release channel c4;

}

—————— bakl2 script——————

#!/ bin/sh

        cd /u01/app/oracle/rmanbak/scripts

      su – oracle -c “rman target / msglog=/u01/app/oracle/rmanbak/logs/bakl2.log < /u01/app/oracle/rmanbak/scripts/bakl2.bak”

——————-bakl2. Bak script————–

run {

    allocate channel c1 device type disk;

    allocate channel c2 device type disk;

    allocate channel c3 device type disk;

    allocate channel c4 device type disk;

    backup incremental level 2 format ‘/u01/app/oracle/rmanbak/bak/inc2_%u_%T’ tag inc2 database;

    release channel c1;

    release channel c2;

    release channel c3;

    release channel c4;

}