Liunx下的Oracle备份

1、配置环境变量
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
ORACLE_SID=ecology; export ORACLE_SID
ORA_NLS33=$ORACLE_HOME/nls/admin/data; export ORA_NLS33
NLS_LANG=american_america.zhs16gbk;export NLS_LANG
PATH=$ORACLE_HOME/bin:$PATH; export PATH

2、配置sh文件
date="$(date -d now +%Y%m%d%H%M)"
days=7
orowner=ecology
bakuser=ecology
bakpass=ecology
bakfile=$orowner"_"$date.dmp
baklog=$orowner"_"$date.log
bakdir=/home/oracledata
ordbak=$orowner"_"$date.tar.gz
cd $bakdir
expdp $bakuser/$bakpass@ecology directory=expdpdata dumpfile=$bakfile logfile=$baklog  schemas=$orowner;
tar -zcvf $ordbak $bakfile $baklog
find $bakdir -type f -name "*.dmp" -exec rm -f {} \;
find $bakdir -type f -name "*.log" -exec rm -f {} \;

find $bakdir -type f -name "*.tar.gz" -mtime +$days -exec rm -f {} \;


3、创建自动运行作业即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值