Tuesday, June 10, 2008

On fly compression ..Export or Import Database on fly

On fly compression -> Export or Import Database on fly… ( On the FLY Compression)

This generally done through pipes on Unix environments.. the process involved in creating a pipe and start the export which run the compression in background.

As an example, here you can find a largely used script to perform on the fly compression of an export operation

#Creating or making a pipe
mknod expdb1.dmp p
#Start compress the pipe in background
gzip -c expdb1.dmp.gz &
& makes the script run in background.
# Wait start the export
sleep 5
# Start the export
exp scott/tiger file=expdb1.dmp
A typical script to execute an import operation reading directly from a compressed file is
# Make a pipe
mknod expdb1.dmp p
# Start decompress to the pipe in background
gzip -c <> expdb1.dmp > &
# Wait start the import
sleep 5
# Start the import
imp scott/tiger file=expdb1.dmp