Compression of dumpfiles with EXP/IMP/EXPDP:

One of the biggest challenges for DBAs is the lack of disk space especially for the backups. Two days before, I came across the  situation where I was need to do export/import schema from UAT to DEV, but none of the mount points on filesystem were having sufficient space available to fit export dumpfile. In my case, taking EXPDP schema backup followed by compresing dumpfile with GZIP/BZIP2 was not possible due to insufficient disk space.

So I started exploring different methodologies to apply compression on dumpfile which will allow me to compress dumpfile on fly.

1. Use of pipes:

Export:


cd /home/oracle
# create a named pipe
mknod exp_disc_schema_scott.pipe p
# read the pipe - output to zip file in the background
gzip < exp_disc_schema_scott.pipe > exp_disc_schema_scott.dmp.gz &
# feed the pipe
exp file=exp_disc_schema_scott.pipe log=exp_disc_schema_scott.log owner=scott

Import:


cd /home/oracle
# create a name pipe
mknod imp_disc_schema_scott.pipe p
# read the zip file and output to pipe
gunzip < imp_disc_schema_scott.dmp.gz > imp_disc_schema_scott.pipe &
# feed the pipe
imp file=imp_disc_schema_scott.pipe log=imp_disc_full.log fromuser=scott touser=scott1

Advantages:

1. Compression happens parallel with the export.
2. Compressed dumpfile can be used for import without decompression. (As shown above)
3. Can be used for 10g as well as 11g.

Disavantages:

1. Can’t use this methodology for EXPDP/IMPDP.


2. Advanced compression:

From 11g, You can used advanced compression menthology to compress dumpfiles on fly. This can be used for compressing data, metadata (which is the default value), both and none.


expdp directory=DATA_PUMP_DIR1 dumpfile=exp_disc_schema_scott.dmp logfile=exp_disc_schema_scott.log schemas=scott compression=all.

Advantages:

1. Compression happens parallel with the export.
2. Compressed dumpfile can be directly used for import without decompression.

Disavantages:

1. It takes more time than normal EXPDP operation.(without compression)
2. Advanced Compression License option must be enabled which is an extra cost.
3. This option is just available from Oracle 11g


 

Hope so u will find this post very useful 🙂

Cheers

Regards,

Adityanath

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