Compression and offsite Backup of Oracle Rman backup sets through shell scripting

Source: Internet
Author: User

1. Background notes

The company tape Library is broken. Where does Oracle's backup go every day?

2. Re-planning the backup method

Original Backup method

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/8F/EC/wKiom1jtyzGCsWHOAADObsChJ9A142.png "title=" Backupbefore.png "alt=" Wkiom1jtyzgcswhoaadobschj9a142.png "/>



Current Backup method

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/8F/EA/wKioL1jtyz2iGxQKAAC6mNObGAg441.png "title=" Backupafter.png "alt=" Wkiol1jtyz2igxqkaac6mnobgag441.png "/>



3. Backup script sharing

Small White wrote a backup of the shell script, share it out

#!/bin/bash# tar oraclebackup file  # check rman is run?# When I do an rman backup, I create an rman log, so this log can tell if my Rman executed the filename= "/mnt/rman/log/rmanbackup_ ' date +%y%m%d '. Log"    comparedata= "Recovery manager complete." if [ -e  $filename  ];then    echo  "' Date '  RMAN is  Run " &>> /OPS/tarlogelse    echo " ' Date '  RMAN is  Not run,please check " &>> /ops/tarlog    exit 1fi#  check rman is ok? #通过判断我的日志最后结果, to determine if the RMAN backup is successful, if not, I do not need to back up Data= ' tail -1 $ FileName ' if [  ' $data  ==  ' $comparedata '  ];then    echo  ' Date '  rman backup sucess '  &>> /ops/tarlogelse    echo   "' Date '  rman backup fail"  &>> /ops/tarlog    exit 2fi# tar backupfile and move to backupserver# Compress the backup set of the day back up and move to the corresponding NFS-provided folder, my 300GB backup compressed as long as 30 g, compression ratio is still very amazing/usr/bin/find /mnt/rman -name  ' Oradb1* '  > /OPS/tarlistfor i in  '/bin/cat /ops/tarlist ';d o     echo  ' Date '  tar  $i  start  &>> /OPS/tarlog     tar -zcvf  $i .tar.gz  $i  &>> /ops/tarlog doneif [ $?  -eq 0 ];then    echo  ' Date '  tar end success   &>> /OPS/tarlog    mv /mnt/rman/*.tar.gz /oraclebackup     if [ $? -eq 0 ];then         echo  "' Date '  move to oraclebackup end success"  &>> / Ops/tarlog    else        echo  "' Date '  move to oraclebackup fail"   &>> /OPS/tarlog    fielse    echo  "' Date '  tar  fail " &>> /ops/tarlogfi


This article is from the "Open World" blog, so be sure to keep this source http://voidyao000.blog.51cto.com/12458042/1915210

Compression and offsite Backup of Oracle Rman backup sets through shell scripting

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.