Linux automatically runs the rman Incremental backup script

Source: Internet
Author: User

I. Incremental backup script
Level 0 backup script: The red part is the directory of the custom backup file
Copy codeThe Code is as follows:
# Script.: BackupFull. sh
# Creater: xyh
# Date: 2014-03-08
# Desc: backup full database datafile in archive with rman
# Connect database
Export ORACLE_BASE =/u01/app/oracle
Export ORACLE_SID = orcl
Export ORACLE_HOME =/u01/app/oracle/product/10.2.0/db_1
Export PATH = $ ORACLE_HOME/bin: $ PATH
Rman target/<EOF_RMAN
Run {
Allocate channel c1 type disk;
Backup incremental level 0 tag 'db0' format
'/Home/oracle/RmanBackup/db0 _ % d _ % T _ % s' database include current controlfile;
SQL 'alter system archive log current ';
Backup filesperset 5 format'/home/oracle/RmanBackup/cf0 _ % d _ % T _ % s' archivelog all delete input;
# Filesperset 5 indicates that the backup set contains a maximum of five files.
Delete noprompt obsolete;
Release channel c1;
}
# End

Level 1 backup script
Copy codeThe Code is as follows:
# Script.: Incrl. sh
# Creater: xyh
# Date: 2014-03-08
# Desc: backup full database datafile in archive with rman
# Connect database
Export ORACLE_BASE =/u01/app/oracle
Export ORACLE_SID = orcl
Export ORACLE_HOME =/u01/app/oracle/product/10.2.0/db_1
Export PATH = $ ORACLE_HOME/bin: $ PATH
Rman target/<EOF_RMAN
Run {
Allocate channel c1 type disk;
Backup incremental level 1 tag 'db1' format
'/Home/oracle/RmanBackup/db1 _ % d _ % T _ % s' database include current controlfile;
SQL 'alter system archive log current ';
Backup filesperset 5 format'/home/oracle/RmanBackup/cf1 _ % d _ % T _ % s' archivelog all delete input;
# Filesperset 5 indicates that the backup set contains a maximum of five files.
Delete noprompt obsolete;
Release channel c1;
}
# End


Ii. use linux crontab settings to automatically execute backup
Copy codeThe Code is as follows:
Crontab-e

After you press Enter, you can Enter the following content like the vi editor.
Copy codeThe Code is as follows:
0 1 ** 0/home/oracle/BackupFull. sh>/home/oracle/BackupFull. log
0 1 ** 3/home/oracle/BackupFull. sh>/home/oracle/BackupFull. log
30 1 ** 1-2/home/oracle/Incrl. sh>/home/oracle/Incr. log
30 1 ** 4-6/home/oracle/Incrl. sh>/home/oracle/Incr. log

View crontab content: crontab-l
Note: The above indicates writing the full-database backup log to the/home/oracle/BackupFull. log File, while the Incremental backup log is written to/home/oracle/Incr. log.
Perform full-database backup at on Sunday and Wednesday, and Incremental backup at on Monday, 2, 4, 5, and 6.

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.