Today's Birthday
Quote of the Day
This Day in History

Tuesday, May 8, 2007

Export to UNIX pipe and Compress

This script exports to a UNIX pipe which is then fed to gzip to create a compressed export dump file.


#!/bin/ksh
. $HOME/.profile
##
## script name : exp_pipe.ksh
## Author : Ramakrishna Nemani
##
## Purpose :
## This script exports to a UNIX pipe which is then fed to gzip to create
## a compressed export dump file
## This is useful when space is at a premium or when you are dealing with
## an export dump file that can grow larger than 2GB and you are working on
## a file system that can not handle files larger than 2GB in size
##
## Note :
## There are a bunch of modifiable parameters in this script that you
## should modify to reflect your environment.
## I have tested this script on UNIX/LINUX
## Use it at your own risk.
##
## This is an example or sample script
##

##
## Begining of modifiable parameters
##

export ORACLE_SID=slsd
EXP_DIR="./"

DUMPFILE=${EXP_DIR}slsd.pipe
GZIPDUMPFILE=${EXP_DIR}slsd_exp.dmp.gz

PARFILE=${EXP_DIR}slsd_exp.par

LOGFILE=${EXP_DIR}exp_slsd.log
ERRFILE=${EXP_DIR}full_exp.out

##
## End of modifiable parameters
##

##
## Create a pipe
##

rm -f $DUMPFILE 2>/dev/null
mknod $DUMPFILE p

##
## Compress using gzip the cat output from pipe. This is done in the background
##

cat $DUMPFILE gzip -c > $GZIPDUMPFILE &

exp parfile=$PARFILE log=$LOGFILE file=$DUMPFILE 2> $ERRFILE

export RETURN_CODE=$?
echo RETURN_CODE: $RETURN_CODE

exit $RETURN_CODE

No comments:

Post a Comment