#!/bin/bash #function: to execute the oracle built-in cmd #version 1 PATH=$PATH:$HOME/bin export PATH export ORACLE_UNQNAME=DB4QIGOU export ORACLE_SID=db4qigou export ORACLE_OWNER=oracle export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export ORACLE_SID ORACLE_BASE ORACLE_HOME export ORA_NLS10=$ORACLE_HOME/nls/data PATH=$PATH:/$ORACLE_HOME/bin:$HOME/bin export PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib export LD_LIBRARY_PATH CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib export CLASSPATH echo "please run this script on cautiously!!!If you forget sth ,or want to abort the script,now ctrl+c will be abort,if you run it bg,you must now how to abort it." sleep 10; echo "now begining" backupdate=`date +%Y%m%d` mkdir -p $backupdate if [[ -d $backupdate ]]&& [[ -f /home/oracle/db_list ]] then cd $backupdate cp /home/oracle/db_list . else exit fi echo "begining exporting....." #for db_name in db_list for db_name in `cat db_list` do exp $db_name/123 OWNER=$db_name FILE=$backupdate$db_name.emp if [ $? -eq 0 ] then echo "you succeed backup the database" else #or > echo "you failed backup,you must rerun the script. backup failed"|tee -a error.message mail -s 16_oracle_bak jinwei.bian@qeegoo.comfinished.message mail -s 16_oracle_bak jinwei.bian@qeegoo.com