Backup script in Oracle 10g archive Mode

Source: Internet
Author: User

This is a production database's rman backup shell script, divided into zero-level backup and one-level differential cumulative backup, zero-level backup once a week, and other one-level differential cumulative backup.

1. Zero-level backup shell script:

  1. #! /Bin/sh
  2. #### 2011.6.27 ####
  3. # Level = 0 #
  4. Export TMP =/tmp
  5. Export TMPDIR =/tmp
  6. Export Oracle_BASE =/opt/oracleonder
  7. Export ORACLE_HOME = $ ORACLE_BASE/product/10.2.0/db_1
  8. Export ORACLE_SID = onder
  9. Export PATH = $ PATH: $ ORACLE_HOME/bin:
  10. Export LD_LIBRARY_PATH = $ ORACLE_HOME/lib:/usr/lib
  11. Export BAKFILE =/opt/bak/bak0.log
  12. Find/opt/bak/archbak-mtime + 365-name "arch * .tar.bz2"-exec rm-rf {}\## because only backup of level 0 is performed every week, archive logs cannot be automatically deleted (only when you run the command # Full backup, archive backup is set to invalid). Therefore, a command is provided to delete the archive log backups outside the storage policy.
  13. Rman nocatalog target/msglog $ BAKFILE <EOF
  14. Run {
  15. Configure controlfile autobackup on;
  16. Configure controlfile autobackup format for device type disk to '/opt/bak/conf_0000f_0000t.tar.bz2 ';
  17. Configure retention policy to redundancy 20;
  18. Configure device type disk parallelism 1 backup type to compressed backupset;
  19. Report obsolete;
  20. Delete noprompt obsolete;
  21. Crosscheck backup;
  22. Delete noprompt expired backup;
  23. Backup incremental level = 0 database format'/opt/bak/bak_effect_0000u_0000t_0000d.tar.bz2 'plus archivelog format'/opt/bak/archbak/arch_0000u_0000s.tar.bz2 ';
  24. DELETE noprompt archivelog all completed before 'sysdate-30 ';
  25. Crosscheck archivelog all; # Check the archived log records that do not exist in the system. Although the preceding command deletes the archived logs for more than 30 days, the related records # record still exists.
  26. Delete noprompt expired archivelog all; ### the noprompt parameter is required to be deleted directly without confirmation.
  27. }
  28. EOF
  • 1
  • 2
  • Next Page

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.