suse下oracle的自動備份指令碼

season0891發表於2009-10-10
ORACLE_BASE=/opt/oracle
ORACLE_HOME=$ORACLE_BASE/product/10g
ORACLE_SID=ora10g
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;

export ORACLE_BASE ORACLE_HOME PATH LD_LIBRARY_PATH NLS_LANG
su - oracle
cd /opt/dbbackup/          
exp office/wyplz@ora10g WNER=office FILE="`date +%Y%m%d`office.dmp" LOG="`date +%Y%m%d`office.log"
zip `date +%Y%m%d`office.zip `date +%Y%m%d`office.dmp `date +%Y%m%d`office.log
exp apollo/apollo@ora10g WNER=apollo FILE="`date +%Y%m%d`apollo.dmp" LOG="`date +%Y%m%d`apollo.log"
zip `date +%Y%m%d`apollo.zip `date +%Y%m%d`apollo.dmp `date +%Y%m%d`apollo.log
exit
scp `date +%Y%m%d`office.zip `date +%Y%m%d`apollo.zip root@1.2.3.4:/home
rm `date +%Y%m%d`apollo.dmp
rm `date +%Y%m%d`apollo.log
rm `date +%Y%m%d`office.dmp
rm `date +%Y%m%d`office.log

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90618/viewspace-616208/,如需轉載,請註明出處,否則將追究法律責任。

相關文章