Oracle DBA Tips and Techniques

By Arjun Raja

Compress and uncompress Files

Posted by Arjun Raja on July 13, 2009

To tar and compress files, backup the files and also untar and uncompress the same files.

cd /u01/oradata/test – area of files .

Now tar and compress and copy the files to backup area – /u02/oradata/test_bkup named as test.tar.gz

tar cvf – * |gzip -c >/u02/oradata/test_bkup/test.tar.gz –

Check for compressed files –

cd /u02/oradata/test_bkup

test:/u02/oradata/test_bkup> ls -lrt
-rw-r–r– 1 oracle dba 105952962 Feb 26 11:31 test.tar.gz


Now to untar and uncompress the files back to the original area –

cd /u01/oradata/test – original area of the files.

gzip -dc < /u02/oradata/test_bkup/test.tar.gz | tar xvf –

Files are uncompressed and sent to original area.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your 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

%d bloggers like this: