Search code examples
ftpsybaseintegritywan

How do I verify the integrity of a Sybase dump file, without trying to load it?


Here's the scenario - a client uploads a Sybase dump file to (gzipped) to our local FTP server. We have an automated process which picks these up and then moves them to different server within the network where the database server resides. Unfortunately, this transfer is over a WAN, which for large files takes a long time, and sometimes our clients forget to FTP in binary mode, which results in 10GB of transfer over our WAN all for nothing as the dump file can't be loaded at the other end. What I'd like to do, is verify the integrity of the dump file on the local server before sending it out over the WAN, but I can't just try and "load" the dump file, as we don't have Sybase installed (and can't install it). Are there any tools or bits of code that I can use to do this?


Solution

  • There are a few things you can do from the command line. The first, on the sending side, is to generate md5sum's of the files.

    $ md5sum *.dmp
    2bddf3cd8b04010183dd3295ce7594ff  pubs_1.dmp
    7510e0250c8d68bae3e0e794c211e60b  pubs_2.dmp
    091fe54fa5fd81d8c109cc7835d37f4a  pubs_3.dmp
    

    On the client side, they can run the same. Secondly, usually Sybase dumps are done with the compress option. If this option is used, you can also test the file integrity by uncompressing the files via the command line. This isn't as complete, but it will verify the 8 byte CRC-32 checksum which is part of the compress algorithm.

    $ gunzip --test *.dmp
    gunzip: pubs_3.dmp: unexpected end of file
    

    Neither of these methods validate that Sybase will be able to load the file, but it does help ensure the file isn't corrupt.