Oracle Data native Automatic backup

Source: Internet
Author: User

1. Creation of three files

Exp.list content:user name and password forOracle Database

Pwd

Exp.log is primarily used to store log information when the database is automatically backed up

exp.sh

#!/bin/SH#找到数据库的路径export oracle_base=/u01/app/Oracleexport Oracle_home= $ORACLE _base/product/10.2.0/db_1 Export PATH= $ORACLE _home/bin: $PATHexport oracle_owner=Oracleexport Oracle_sid=Orclexport Nls_lang=American_america.zhs16gbkexport Ld_library_path= $ORACLE _home/lib:/usr/lib# execution Path CD/home/oracle/Dbbackupexptime=$(Date+%y-%m-%d_%H) #读取创建的exp user name and password in the. list fileCatExp.list | whileRead DbUser dbpasswd Do                                                                                                Echo$dbUser Exp $dbUser/$DBPASSWD Grants=yfile= $dbUser"_"$exptime. DMP #执行导出if["0"== $? ]         Then                   Tar-ZCVF $dbUser"_"$exptime. DMP.Tar. GZ $dbUser"_"$exptime. DMPRM$dbUser"_"$exptime. DMPfi Done#导出文件名Find. -mtime +6-name"*.dmp.tar.gz"|Xargs RM

2. This script is added to the scheduled task

Crontab-  E

* * 0/home/oracle/dbbackup/exp.sh >>/home/oracle/dbbackup/exp.log 2>&1

It means: Sunday night of every week, the /home/oracle/dbbackup of the exp.sh Script, the error message will be placed under exp.log If the script executes errors.

Oracle data native automatic backup

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.