The "Vimal Mohan" Blog

Oracle, Unix basics & tricks for all those interested in discovering…

Posts Tagged ‘compress’

Export and Import using split compressed dumps

Posted by Vimal Mohan on December 9, 2010

I see this as one of the extensively used process and thought of sharing it with you all.

We all might encounter a scenario to use export/import for database/schema/object refresh, but the underlying infrastructure doesn’t give you the support to complete this without much fight. They being transferring the data from source server to target (servers being on either side of the ocean) and the source/target filesystem sets a file size limit of 2 GB or so. Below Export and Import process will help you create compressed dumps, with size not more than 2 GB each in Unix.

Export –

# Create Pipes for Export
ExpFile=ExpName.dmp.Z.
Pipe=/tmp/pipe.$$
rm -f $Pipe
mknod $Pipe p

# Run the compress in the background
(compress <$Pipe | split -b 2048m – $ExpFile) &

# Run the export in the foreground
exp / owner=abc file=$Pipe >Exp.Log 2>&1 <&-

This will create export dumps of 2GB size with the name –

ExpName.dmp.Z.aa
ExpName.dmp.Z.ab
ExpName.dmp.Z.ac
and so on…

Import –

# Create Pipes for Import
ImpFile=ExpName.dmp.Z.
Pipe=/tmp/Pipe.$$
rm -f $Pipe
mknod $Pipe p

# Run the uncompress of the files into uncompress into pipe in the background
(cat ${ImpFile}* | uncompress >$Pipe) &

# Run the import in the foreground
imp / fromuser=abc touser=abc file=$Pipe >Imp.Log 2>&1 <&-

Posted in Oracle | Tagged: , , , | Leave a Comment »