#!/bin/sh
export ORACLE_BASE=/app/oracle/
export ORACLE_HOME=/app/oracle/product
export PATH=$ORACLE_HOME/bin:$HOME/bin:$PATH
export ORACLE_OWNER=oracle
export ORACLE_SID=orcl
#数据库备份存放目录
#BACKUP_DIR=/home/oracle/databack
#进行备份
#备份数据库名
BACKUP_USER=test_bak
#数据库密码
BACKUP_PASSWORD=oracle
su - oracle -c "/u01/app/ora10/product/bin/expdp $BACKUP_USER/$BACKUP_PASSWORD schemas=$BACKUP_USER directory=my_dir dumpfile=$BACKUP_USER.dmp log=$BACKUP_USER.log"
#将备份进行压缩存档
cd $BACKUP_DIR
tar -zcvf $BACKUP_USER-`date +%y%m%d%H%M`.tar.gz $BACKUP_USER-`date +%y%m%d%H%M`.dmp $BACKUP_USER-`date +%y%m%d%H%M`.log
list=` find $BACKUP_DIR -mtime +10`
echo $list
rm -f $list
ALTER SYSTEM SET db_recovery_file_dest_size=5g scope=both