Posted by: Monish | April 28, 2011

EXP using pipe

Using the following script we can take export backup using pipe.
Change the DIRECTORY value to your backup location.

suppose the following script name is exp_pipe.ksh then execute it as

nohup ./exp_pipe.ksh $SID &

—————————————————————————————–
#!/usr/bin/ksh
if [ $# -ne 1 ]
then
   echo “Usage : $0 ORACLE_SID”
   exit
fi

export ORACLE_SID=$1
export NLS_LANG=’AMERICAN_AMERICA.WE8ISO8859P1′

export ORACLE_HOME=/u01/oracle/product/9.2.0
DATE=`date +%Y%m%d`
DIRECTORY=/u01/backup; export DIRECTORY
FILENAME=${DIRECTORY}/${ORACLE_SID}_${DATE}.dmp.gz; export FILENAME
LOG=${DIRECTORY}/${ORACLE_SID}_${DATE}.log; export LOG
PIPE=${DIRECTORY}/export_pipe_${DATE}.dmp; export PIPE

rm -f ${PIPE}
test -p ${PIPE} || mknod ${PIPE} p
chmod +rw ${PIPE}

ls -l $PIPE
echo “cat $PIPE | /usr/bin/gzip > ${FILENAME}”
echo “${ORACLE_HOME}/bin/exp log=${LOG} file=${PIPE} owner=scott”
cat $PIPE | /usr/bin/gzip > ${FILENAME} &
${ORACLE_HOME}/bin/exp log=${LOG} file=${PIPE} STATISTICS=NONE owner=scott  <<!
db_user/password123@${ORACLE_SID}
!
—————————————————————————————-

To execute the same script in HP-UNIX environment, change the gzip location to /usr/contrib/bin/gzip

———————-

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories