Regular oracle database backup and oracle Database Backup

Source: Internet
Author: User

Regular oracle database backup and oracle Database Backup

Currently, we need to design a batch of processing files to achieve full backup on Monday, Incremental backup on Tuesday, Friday, and Incremental backup on Thursday and Sunday. In addition, the daily data of the previous month is deleted on a daily basis (for example, the data of the current month is deleted on February 1,), and the backup is compressed to reduce the occupied space.

Ideas:

Backup: 1) delete data from the previous month.

2) execute different backup commands by judging the day of the week.

3) Add the backup file to the compressed package.

4) Delete the backup file.

Restore: if there is a problem with the database on Saturday, you need to import all the backups on Monday, the accumulated backups on Thursday, and the incremental backups on Friday.

Backup code:

@ Rem: delete the history backupsdel/f/s/q F: \ backup \ * % date :~ 8, 22.16.zip @ rem: create the new backupsif "% date :~ 12,1% "=" 1 "exp XXXXXX/XXXXXX inctype = complete file = f:/backup/% date :~ 0, 4% % date :~ 5, 2% % date :~ 8, 2%. dmpif "% date :~ 12,1% "=" 2 "exp XXXXXX/XXXXXX inctype = incremental file = f:/backup/% date :~ 0, 4% % date :~ 5, 2% % date :~ 8, 2%. dmpif "% date :~ 12,1% "=" 3 "exp XXXXXX/XXXXXX inctype = incremental file = f:/backup/% date :~ 0, 4% % date :~ 5, 2% % date :~ 8, 2%. dmpif "% date :~ 12,1% "=" 4 "exp XXXXXX/XXXXXX inctype = cumulative file = f:/backup/% date :~ 0, 4% % date :~ 5, 2% % date :~ 8, 2%. dmpif "% date :~ 12,1% "=" 5 "exp XXXXXX/XXXXXX inctype = incremental file = f:/backup/% date :~ 0, 4% % date :~ 5, 2% % date :~ 8, 2%. dmpif "% date :~ 12, 1% "=" 6 "exp XXXXXX/XXXXXX inctype = incremental file = f:/backup/% date :~ 0, 4% % date :~ 5, 2% % date :~ 8, 2%. dmpif "% date :~ 12,1% "=" 7 "exp XXXXXX/XXXXXX inctype = cumulative file = f:/backup/% date :~ 0, 4% % date :~ 5, 2% % date :~ 8, 2%. dmp @ rem: take the backups to zip "E: \ Program Files (x86) \ WinRAR \ WinRAR.exe" a F: \ backup \ % date :~ 0, 4% % date :~ 5, 2% % date :~ 8, 22.16.zip F: \ backup \ % date :~ 0, 4% % date :~ 5, 2% % date :~ 8, 2%. dmp @ rem: delete the new backupsdel/f/s/q F: \ backup \ * % date :~ 8, 2%. dmppause

Note: 1) because the compression software is required during compression, install winrar as much as possible, such as , but sometimes unexpected problems may occur.

2) In this batch, all generated files use the current time as the file name. Baidu or leave a message that you cannot understand.

Restore code:

Imp XXXXXX/XXXXXX inctype = restore FULL = y file = F: \ backup \ 20150807.dmp

Note: During restoration, you only need to modify the imported file name.

Log files are not set for import and export.


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.