Search This Blog

Total Pageviews

Friday, 18 June 2010

Data pump Shell Script on Oracle Solaris

#CREATE DIRECTORY datapump AS '/opt/oracle/backup/DataPump/Backup';


# !/bin/bash

TODAY=`date`

ORACLE_SID=orcl ; export ORACLE_SID

ORACLE_BASE=/opt/oracle ; export ORACLE_BASE

ORACLE_HOME=/opt/oracle/product/10.2 ; export ORACLE_HOME

PATH=${ORACLE_HOME}/bin:$PATH ; export PATH

EXPFILE=$ORACLE_SID.datapump.`date +%m%d%Y`.dmp; export EXPFILE

ERRFILE=$ORACLE_SID.datapump.`date +%m%d%Y`.err; export ERRFILE

LOGFILE=$ORACLE_SID.datapump.`date +%m%d%Y`.log ; export LOGFILE

SUCC=/opt/oracle/backup/DataPump/Backup/SUCC.txt ; export SUCC



# echo $EXPFILE



find /opt/oracle/backup/DataPump/Backup -name "*.err" -mtime +2 -exec rm {} \;



ps -ef | grep -i smon|grep -v grep|wc -l> oracle.exp



if [ `cat oracle.exp|grep -v grep|grep -i "1"|wc -l` -eq 1 ]; then



[ -f $ERRFILE ]; rm $ERRFILE



expdp "'/ as sysdba'" directory=datapump DUMPFILE=$EXPFILE SCHEMAS=SCOTT,XYZ logfile=$LOGFILE EXCLUDE=STATISTICS parallel=4



fi



find /opt/oracle/backup/DataPump/Backup -name "$ORACLE_SID.export.*" -mtime +3 -exec rm {} \;

Oracle DBA

anuj blog Archive