Oracle EXPDP Backup Scripts

Source: Internet
Author: User

#!/bin/Bash
#Oracle Environment Variables Nls_lang=American_america. Al32utf8oracle_sid=Zgworacle_base=/opt/Oracleoracle_home=/opt/oracle/11gPATH= $PATH: $ORACLE _home/bin: $HOME/binexport oracle_sid oracle_base oracle_home nls_lang PATH#获取时间戳export Bakuptime=`Date+%y%m%d%h%m%S '
#dump文件生成目录Export Data_dir=/home/oracle/backup/Dump
#压缩文件存放目录Export Tar_dir=/home/oracle/backup/tarsmkdir-P $DATA _dirmkdir-p $TAR _dircd $DATA _dirEcho "starting Bakup ..."Echo "bakup file path $DATA _dir/scott_expdp_$bakuptime.dmp"

#使用expdp时需要先指定转储文件和日志文件所在的目录, you can implement the following command
#SQL >create OR REPLACE DIRECTORY scott_backup as '/home/oracle/backup/dump ';
#SQL >grant read,write on directory scott_backup to Scott;
EXPDP Scott/scott directory=scott_backup dumpfile=scott_expdp_$bakuptime.dump logfile=scott_expdp_$bakuptime.log Parallel=4
#parallel =4 for parallelism, it helps to reduce backup time for backing up large databases, but increases CPU load.
Echo " Starting tar ... " Echo " Tar file path $TAR _dir/scott_$bakuptime.tar.gz " tar -zcvf $TAR _dir/scott_expdp_$bakuptime. tar. GZ scott_expdp*echo"bakup job is done! " #历史dump文件保留7天 Find  $DATA _dir-type F-mtime +7rm -rf {} \;

Reference: http://blog.itpub.net/235507/viewspace-704379/

Oracle EXPDP Backup script

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.