Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

gunzip shows invalid compressed data--format violated

radhakrishnan ravi
Occasional Advisor

gunzip shows invalid compressed data--format violated

Hi,
While doing export dumps from Oracle databases I use the split script as shown below to keep the size of the dump files within a reasonable limit,
TAB=DWH_TABLES
rm -f $TAB.pipe
rm -f $TAB.split.pipe
rm -f xa*
/sbin/mknod $TAB.pipe p
/sbin/mknod $TAB.split.pipe.gz p
/sbin/mknod xaa p
/sbin/mknod xab p
cat xaa >exp_aa.dmp.gz &
cat xab >exp_ab.dmp.gz &
gzip < $TAB.pipe > $TAB.split.pipe.gz &
split -b 2000m $TAB.split.pipe.gz &
nohup exp file=$TAB.pipe .........

While doing an import as shown in the script below,
rm exppipe.gz
rm bedpipe.dmp
/sbin/mknod exppipe.gz p
/sbin/mknod bedpipe.dmp p
cat exp_aa.dmp.gz > exppipe.gz &
gunzip < exppipe.gz > bedpipe.dmp &
nohup imp file=bedpipe.dmp ................

Iam getting the following error message,
gunzip: stdin: invalid compressed data--format violated
[1] + Broken Pipe cat exp_aa.dmp.gz > exppipe.gz &

How to get rid of this and extract the data safely from the file exp_aa.dmp.gz.
-rw-r--r-- 1 oracle dba 212238107 Jul 9 11:46 exp_aa.dmp.gz
cksum exp_aa.dmp.gz
366494054 212238107 exp_aa.dmp.gz

TIA
Ravi
7 REPLIES
Muthukumar_5
Honored Contributor

Re: gunzip shows invalid compressed data--format violated

gunzip is used to expand the zipped files on gz format.

cat exp_aa.dmp.gz > exppipe.gz &
gunzip < exppipe.gz > bedpipe.dmp &
nohup imp file=bedpipe.dmp ................

Where exppipe.gz is a not a gz format file. If you do then,
gunzip: stdin: invalid compressed data--format violated
[1] + Broken Pipe cat exp_aa.dmp.gz > exppipe.gz &

it will come.. there.

Example:

echo test > test.gz
gunzip < test.gz

Use zcat to cat the zipped files.

Transfer them as stdout to the gunzip command and redirect into bedpipe.dmp file.
Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: gunzip shows invalid compressed data--format violated

cat exp_aa.dmp.gz > exppipe.gz &
gunzip < exppipe.gz > bedpipe.dmp &
nohup imp file=bedpipe.dmp ................

-- where,

exppipe.gz is not a gzipped file to gunzip.

Use as like,
cat exp_aa.dmp.gz > exppipe.gz &
gzip exppipe.gz &
gunzip < exppipe > bedpipe.dmp &
nohup imp file=bedpipe.dmp ................

Easy to suggest when don't know about the problem!
radhakrishnan ravi
Occasional Advisor

Re: gunzip shows invalid compressed data--format violated

Hi,
I have tried as suggested by you. Still remains the error. But that was the split script being used months together for creating export dumps and import back. This is the first time the import is failing.
cat exp_aa.dmp.gz > exppipe.gz &
gzip exppipe.gz &
gzip: exppipe.gz is not a directory or a regular file - ignored

zcat exp_aa.dmp.gz > exppipe.gz &
exp_aa.dmp.gz.Z: No such file or directory

I did another trick by FTPing the dump exp_aa.dmp.gz to Windows 2000 in BINARY mode and tried to unzip with PKUNZIP which reported the message 'Archive contains the compressed file exp_aa.tmp.tar. Would you like to open it in the temporary directory and uncompress the file?'.
Iam wondering how come a .tar format has been embedded in the gzip file. PKUNZIP recovers upto 6MB size and aborts with 'Errors in .zip file'.
How to get the tar out of the gzip file.

TIA
Ravi
Muthukumar_5
Honored Contributor

Re: gunzip shows invalid compressed data--format violated

Ravi,

Your another try as,

cat exp_aa.dmp.gz > exppipe.gz &
gzip exppipe.gz &
will get error as
gzip: exppipe.gz is not a directory or a regular file - ignored

because,

exppipe.gz is not gzipped file. You can test it by add a line as file exppipe.gz after cat line.

You have to use as,

cat exp_aa.dmp.gz > exppipe.gz &
gzip < exppipe.gz > test.gz &
gunzip < test.gz > bedpipe.dmp &

where bedpipe.dmp will contains all data.

Simple logic, readable informations are made "cat" to exppipe.gz file. exppipe.gz file is zipped and unzipped to *.dmp file.

Else regarding to your logic of script lines,

cat exp_aa.dmp.gz > bedpipe.dmp &

because
cat exp_aa.dmp.gz > exppipe.gz &

saying that exppipe.gz can not be a gzipped file.

Start a file check on every file as,

file exp_aa.dmp.gz;

if it is a gzipped file then,
we can not use cat command there,

so gunzip < exp_aa.dmp.gz > bedpipe.dmp &

It is good to check ur self about the file status and it's type.
Easy to suggest when don't know about the problem!
radhakrishnan ravi
Occasional Advisor

Re: gunzip shows invalid compressed data--format violated

Thanx for your efforts Mr.Muthukumar,
As suggested by you I did as follows,
gunzip < exp_aa.dmp.gz > two_tabs.dmp &
[1] 18330
gunzip: stdin: invalid compressed data--format violated

[1] + Done(1) gunzip < exp_aa.dmp.gz > two_tabs.dmp &
gunzipping broke after reading for a few seconds and wrote to the file as,
-rw-r--r-- 1 oracle dba 7143424 Aug 23 08:47 two_tabs.dmp
Thereafter the dump is unable to be read. So I believe there is corruption of data in the dump.
file exp_aa.dmp.gz
exp_aa.dmp.gz: awk program text
file two_tabs.dmp
two_tabs.dmp: data
Is there any other way to crack into the gzipped dump (exp_aa.dmp.gz) and retrieve useful data as much as possible.

TIA
Ravi
Elmar P. Kolkman
Honored Contributor

Re: gunzip shows invalid compressed data--format violated

Could it be possible you miss the xab or exp_ab.dmp.gz part during the input ?!

I would replace the cat command in the import script to the following:
cat exp_aa.dmp.gz exp_ab.dmp.gz > exppipe.gz &

And the test the rest of the script. Because with the script so for, you miss the concatenation of the two possible parts of the gzipped dump.
Every problem has at least one solution. Only some solutions are harder to find.
radhakrishnan ravi
Occasional Advisor

Re: gunzip shows invalid compressed data--format violated

Thanx Mr.Elmar,
/sbin/mknod xaa p
/sbin/mknod xab p
cat xaa >exp_aa.dmp.gz &
cat xab >exp_ab.dmp.gz &
split -b 2000m $TAB.split.pipe.gz &
nohup exp file=$TAB.pipe .........

As there were lesser amount of rows in the tables being exported, the split has written to only one dump file 'aa' with a size of 212238107 bytes. The other file 'ab' is 0 bytes.
Notwithstanding that, I tried as suggested,
/sbin/mknod exppipe.gz p
cat exp_aa.dmp.gz exp_ab.dmp.gz > exppipe.gz &
gunzip < exppipe.gz > tt.dmp &

This time I wanted to just unzip and write to the file tt.dmp which shall be used later for import.
But gunzip failed at the same place as earlier,
gunzip: stdin: invalid compressed data--format violated
It has wrote to the file tt.dmp upto 7143424 bytes. Seems it has read 872 blocks from the dump. How to go past this to get the good blocks.

TIA
Radhakrishnan Ravi