Skip site navigation (1) Skip section navigation (2)

Can't recover data from a .tar.gz file which was backed up using COPY BINARY command

From: Khangelani Gama <kgama(at)argility(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Can't recover data from a .tar.gz file which was backed up using COPY BINARY command
Date: 2012-03-01 07:51:57
Message-ID: 539e85fb02376a0adb1ab5eb6e833cb3@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-admin
Someone in our company wrote a script that backs up data from a certain
table, that person left the company and no one is able to figure it out.
Part of this script has something like, look at the COPY BINARY command
just below:



EXPORTFILE=${EXPORTFILE}.${AUD_UP_TO}_${MAX_AUDIT}

   *$PSQL -c "COPY BINARY dailybackup TO '$EF_PATH/$EXPORTFILE';"*



   if [ $? -eq 0 ]; then

      cd $EF_PATH

      tar cvzf ${EXPORTFILE}.tar.gz ${EXPORTFILE}

      if [ $? -ne 0 ]; then

         echo -e "Error while compressing tar file :  " >
/tmp/backup.trickle.state

         echo `date` >> /tmp/backup.trickle.state



fi



   echo "Backup to backup disk successful"



   echo "Update trickle checkpoint"



   ${ANT} run -Dclass=ucs.instore.ejb.system.SetTrickleCheckpoint
-Darg1=${MAX_AUDIT}







I tried to untar the file which went through fine, but now inside the file
there is funny characters, see below:



PGBCOPY

ÿ^M

^(at)^D^C^B^A^@^(at)^@^(at)^@^(at)^@^(at)^R^@^D^(at)~UIS^@ÿÿ
^(at)^@^(at)1~1~1^D^@^É^(at)^@^D^(at)^@^(at)^@^(at)ÿÿ^K^@^(at)^@day_endÿÿ^K^(at)^@^(at)central^H^@wIôðå϶Aÿÿ¶^B^(at)^@<?xml
version="1.0" encoding="UTF-8"?>^M





I am aware of the following format, but can’t figure out how many
characters should I specify and this backup system doesn’t use pg_dump
command?





COPY [ BINARY ] table_name [ WITH OIDS ]

    FROM { 'filename' | STDIN }

    [ [USING] DELIMITERS 'delimiter' ]

    [ WITH NULL AS 'null string' ]







Thanks in advanced





CONFIDENTIALITY NOTICE
The contents of and attachments to this e-mail are intended for the addressee only, and may contain the confidential information of Argility (Proprietary) Limited and/or its subsidiaries. Any review, use or dissemination thereof by anyone other than the intended addressee is prohibited.
If you are not the intended addressee please notify the writer immediately and destroy the e-mail. Argility (Proprietary) Limited and its subsidiaries distance themselves from and accept no liability for unauthorised use of their e-mail facilities or e-mails sent other than strictly for business purposes.

Responses

pgsql-admin by date

Next:From: Simon RiggsDate: 2012-03-01 08:35:01
Subject: Re: Hot standby having high requested checkpoints?
Previous:From: Fujii MasaoDate: 2012-03-01 02:17:59
Subject: Re: Hot standby having high requested checkpoints?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group