Linux crontab manages automatic one-week Incremental backup of RMAN

Source: Internet
Author: User

Write the corresponding backup script rmanbklevel_0.sh rmanbklevel_1.sh rmanbklevel_2.sh
[Oracle @ oracle11gR2 scripts] $ pwd
/U01/scripts
[Oracle @ oracle11gR2 scripts] $ ll
Total 44
-Rw-r --. 1 oracle oinstall 102 Jul 20 audit. SQL
-Rwxr-xr-x. 1 oracle oinstall 398 Jul 22 coldbak. sh
-Rw-r --. 1 oracle oinstall 829 Jul 17 deadlock. SQL
-Rw-r --. 1 oracle oinstall 126 Jul 20 fail_count. SQL
-Rw-r --. 1 oracle oinstall 327 Jul 20 fail_user. SQL
-Rwxr-xr-x. 1 oracle oinstall 260 Jul 22 rmanbklevel_0.sh // level 0 backup must have executable permissions x
-Rwxr-xr-x. 1 oracle oinstall 260 Jul 22 rmanbklevel_1.sh // Level 1 backup must have executable permissions x
-Rwxr-xr-x. 1 oracle oinstall 260 Jul 22 rmanbklevel_2.sh // Level 2 backup must have executable permissions x
-Rw-r --. 1 oracle oinstall 116 Jul 20 spid. SQL
-Rw-r --. 1 oracle oinstall 143 Jul 17 undo. SQL
-Rwxr-xr-x. 1 oracle oinstall 613 Jul 22 userbak. sh
[Oracle @ oracle11gR2 scripts] $


[Oracle @ oracle11gR2 scripts] $ vi rmanbklevel_0.sh // backup script of level 0
#! /Bin/sh
Export ORACLE_SID = orcl
Rman log = '/rmanbk/bakl0.log' append <EOF
Connect target /;
Run {
Allocate channel cha1 type disk;
Backup
Incremental level 0
Format '/rmanbk/incremental_level0 _ % u _ % t'
Tag backup_inc0
Database;
Release channel cha1;
}
EOF
Exit


[Oracle @ oracle11gR2 scripts] $ vi rmanbklevel_1.sh // Level 1 backup script


#! /Bin/sh
Export ORACLE_SID = orcl
Rman log = '/rmanbk/bakl1.log' append <EOF
Connect target /;
Run {
Allocate channel cha1 type disk;
Backup
Incremental level 1
Format '/rmanbk/incremental_level1 _ % u _ % t'
Tag backup_inc1
Database;
Release channel cha1;
}
EOF
Exit


[Oracle @ oracle11gR2 scripts] $ vi rmanbklevel_2.sh // Level 2 backup script
#! /Bin/sh
Export ORACLE_SID = orcl
Rman log = '/rmanbk/bakl2.log' append <EOF
Connect target /;
Run {
Allocate channel cha1 type disk;
Backup
Incremental level 2
Format '/rmanbk/incremental_level2 _ % u _ % t'
Tag backup_inc2
Database;
Release channel cha1;
}
EOF
Exit


Add a crontab Task Scheduler as the root user
[Root @ oracle11gR2 ~] # Crontab-e
59 19 ** 0 su-oracle-c/u01/scripts/rmanbklevel_0.sh backup at every Sunday
59 19 ** 1 su-oracle-c/u01/scripts/rmanbklevel_2.sh backups at every Monday
59 19 ** 2 su-oracle-c/u01/scripts/rmanbklevel_2.sh Level 2 backup every Tuesday
59 19 ** 3 su-oracle-c/u01/scripts/rmanbklevel_1.sh level-1 backup every Wednesday
59 19 ** 4 su-oracle-c/u01/scripts/rmanbklevel_2.sh Level 2 backup every Thursday
59 19 ** 5 su-oracle-c/u01/scripts/rmanbklevel_2.sh backups at every Friday
59 19 ** 6 su-oracle-c/u01/scripts/rmanbklevel_2.sh backups at every Saturday
Save and exit


[Root @ oracle11gR2 ~] # Service crond restart // restart Task Plan
Stopping crond: [OK]
Starting crond: [OK]

Automatic RMAN backup task completed in one week

Recommended reading:

Basic Oracle tutorial-copying a database through RMAN

Reference for RMAN backup policy formulation

RMAN backup learning notes

Oracle Database Backup encryption RMAN Encryption

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.