2015년 4월 19일 일요일

ORACLE : Oracle Backup Shell Script Sample

#!/bin/bash

ORACLE_HOME=/home/oracle/product/8.1.7
export NLS_LANG=AMERICAN_AMERICA.KO16KSC5601
ORACLE_SID=orcl
export ORACLE_HOME ORACLE_SID

DATE=$(date +'%Y%m%d')
DIR=/home/backup

find $DIR -type f -name '*.dmp' -mtime +12 -exec rm -rf {} \;

$ORACLE_HOME/bin/exp userid=dhbook/orpwd@loc100 file=$DIR/dhbook$DATE.dmp compress=n
cd $DIR

if [ -e dhbook$DATE.dmp ]; then
tar cvfz dhbook$DATE.tar.gz  dhbook$DATE.dmp
rm -rf dhbook$DATE.dmp
fi

댓글 없음:

댓글 쓰기