Sunday, 29 July 2012

Compress EXP/IMP Using Pipes

exporting using pipe:-

$ mknod exp_p.pipe p
$ gzip -c < exp_p.pipe > /home/oracle/full_db.gz &
$ exp "'sys/admin@orcl as sysdba'" file=exp_p.pipe full=y log=full.log


a) create a pipe file using mknod utility.

b) The gzip will compress the data which are received through the pipe and 
it will create a gz (zip) file as full_db.gz, start this to run
in the background.

c) when expoing the data in the file parameter give the name of the
pipe file which been started using the mknod utility.


Importing using pipe:-

$ mknod imp_p.pipe p
$ gunzip -c < full_db.gz > /home/oracle/imp_p.pipe &
$ imp "'sys/admin@orcl as sysdba'" file=imp_p.pipe tables=emp fromuser=manzoor touser=manzoor

a) Create a pipe file using mknod utility. 

b) the gunzip will uncomrpress the compressed file and and tranfer it
to the imp_p.pipe file.

c) when importing the data, in the file parameter give the name of the
pipe which is recived the data from the gunzip.

Script


#!/bin/ksh
# Script to take Full export using pipe.

dmpf=/home/oracle/full_db.gz
GZIP=/var/tmp/gzip

rm -f newer_than_2.pipe wc.log newer_than_2.log
mknod newer_than_2.pipe p
$GZIP -c $dmpf &
exp parfile=newer_than_2.par
if [ $? -eq 0 ] ; then
echo "***"
echo "*** SUCCESS exp parfile=newer_than_2.par"
else
echo "***"
echo "*** FAIL exp parfile=newer_than_2.par exit"
exit 1
fi

# confirm export file exists
echo "***"
echo "*** export file:"
ls -l $dmpf
# EOF

No comments:

Post a Comment