Oracle Database scheduled backup script

Source: Internet
Author: User

First, write the script


#! /usr/bin# path name, specifying the path of the backup filepath=/home/backup/oracledata# the backup database filename filename= ' date + '%y%m%d_%h%m ' #切换至指定路径 according to the specified date format, and create a folder CD $FILEPATHmkdir $FILENAMEchmod 775 $FILENAME #oracle variable settings export user=oracle;export oracle_sid=ecology;export Oracle_home=/u01/app/oracle/product/11.2.0/db_1;export path= $ORACLE _home/bin: $PATH; #导出数据库exp ecology/ecology file = "$FILENAME/$FILENAME". DMP log= "$FILENAME/$FILENAME". Log owner=ecology# Package TAR-ZCVF $FILENAME. tar.gz $FILENAMErm-RF $ FILENAMESCP $FILENAME. tar.gz [email protected]: $FILEPATH/find./-mtime +30-name \*.gz |xargs rm-fexiteof

After the script is executed, the backup data is synchronized to the same location on the standby machine

Second, set up the Scheduled tasks


#备份数据库0 3 * * */bin/bash/home/backup/

Service Crond Restart

Oracle Database scheduled backup script

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: 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.