Thread: PG dump and restore
Greetings;
As I've been doing for quite some time, backed up my database as such: /opt/local/lib/postgresql84/bin/pg_dump -c -f ./Trading-Access -Z 5 Trading-Access
But then when I tried restoring it my usual way as such: /opt/local/lib/postgresql84/bin/pg_restore -d Trading-Access ./Trading-Access
it causes the error: pg_restore: [archiver] input file does not appear to be a valid archive
So in trying: /opt/local/lib/postgresql84/bin/psql Trading-Access < ./Trading-Access
it causes the error: invalid byte sequence for encoding "UTF8": 0x8b
Thanks,
On 25 June 2010 16:28, Dennis C <dcswest@gmail.com> wrote: > Greetings; > As I've been doing for quite some time, backed up my database as > such: /opt/local/lib/postgresql84/bin/pg_dump -c -f ./Trading-Access -Z 5 > Trading-Access > But then when I tried restoring it my usual way as > such: /opt/local/lib/postgresql84/bin/pg_restore -d Trading-Access > ./Trading-Access > it causes the error: pg_restore: [archiver] input file does not appear to be > a valid archive > So in trying: /opt/local/lib/postgresql84/bin/psql Trading-Access < > ./Trading-Access > it causes the error: invalid byte sequence for encoding "UTF8": 0x8b > Thanks, If the output file is in custom format, that last step shouldn't work since custom format isn't parsable by psql. That would only work if it was dumped in plain format. Your original dump specifies a compression level, but you didn't specify "-F c" for custom format, which would use the compression level. Is your file human readable? Try running "file Trading-Access" on the file. What does it say? Thom
On Fri, 2010-06-25 at 08:28 -0700, Dennis C wrote: > Greetings; > > > As I've been doing for quite some time, backed up my database as > such: /opt/local/lib/postgresql84/bin/pg_dump -c -f ./Trading-Access > -Z 5 Trading-Access > > > But then when I tried restoring it my usual way as > such: /opt/local/lib/postgresql84/bin/pg_restore -d > Trading-Access ./Trading-Access > it causes the error: pg_restore: [archiver] input file does not appear > to be a valid archive You don't use pg_restore for plain text dumps which is what you are doing above. You use psql. > > > So in trying: /opt/local/lib/postgresql84/bin/psql Trading-Access > < ./Trading-Access > it causes the error: invalid byte sequence for encoding "UTF8": 0x8b It means the database you has characters in it that are not UTF8 compliant. You can use iconv to clean it up. Joshua D. Drake > > > Thanks, -- PostgreSQL.org Major Contributor Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579 Consulting, Training, Support, Custom Development, Engineering
It says "Trading-Access: gzip compressed data, from Unix"
About the idea of not using pg_restore for these dumps, what I'm still missing is how it's worked for all these years before. Are there now more stringent standards being enforced?
On Fri, Jun 25, 2010 at 8:37 AM, Thom Brown <thombrown@gmail.com> wrote:
If the output file is in custom format, that last step shouldn't workOn 25 June 2010 16:28, Dennis C <dcswest@gmail.com> wrote:
> Greetings;
> As I've been doing for quite some time, backed up my database as
> such: /opt/local/lib/postgresql84/bin/pg_dump -c -f ./Trading-Access -Z 5
> Trading-Access
> But then when I tried restoring it my usual way as
> such: /opt/local/lib/postgresql84/bin/pg_restore -d Trading-Access
> ./Trading-Access
> it causes the error: pg_restore: [archiver] input file does not appear to be
> a valid archive
> So in trying: /opt/local/lib/postgresql84/bin/psql Trading-Access <
> ./Trading-Access
> it causes the error: invalid byte sequence for encoding "UTF8": 0x8b
> Thanks,
since custom format isn't parsable by psql. That would only work if
it was dumped in plain format.
Your original dump specifies a compression level, but you didn't
specify "-F c" for custom format, which would use the compression
level.
Is your file human readable? Try running "file Trading-Access" on the
file. What does it say?
Thom
On 06/25/2010 09:04 AM, Dennis C wrote: > It says "Trading-Access: gzip compressed data, from Unix" > > About the idea of not using pg_restore for these dumps, what I'm still > missing is how it's worked for all these years before. Are there now more > stringent standards being enforced? > > You have restored from these dumps using pg_restore? The command below says create a plain text file that has commands to clean database objects before recreating and store text in file ./Trading-Access using gzip compression at level 5: /opt/local/lib/postgresql84/bin/pg_dump -c -f ./Trading-Access -Z 5 Trading-Access To restore I would think you need to gunzip ./Trading-Access and then feed the file to psql. -- Adrian Klaver adrian.klaver@gmail.com
OK well the gunzip seemed to "do the trick," but I don't recall before having to do anything other than run the pg_restore command. Anyway, thanks to everyone for all your help!
On Fri, Jun 25, 2010 at 11:29 AM, Adrian Klaver <adrian.klaver@gmail.com> wrote:
On 06/25/2010 09:04 AM, Dennis C wrote:You have restored from these dumps using pg_restore?It says "Trading-Access: gzip compressed data, from Unix"
About the idea of not using pg_restore for these dumps, what I'm still
missing is how it's worked for all these years before. Are there now more
stringent standards being enforced?
The command below says create a plain text file that has commands to clean database objects before recreating and store text in file ./Trading-Access using gzip compression at level 5:To restore I would think you need to gunzip ./Trading-Access and then feed the file to psql.
/opt/local/lib/postgresql84/bin/pg_dump -c -f ./Trading-Access -Z 5 Trading-Access
--
Adrian Klaver
adrian.klaver@gmail.com
On Friday 25 June 2010 4:59:17 pm Dennis C wrote: > OK well the gunzip seemed to "do the trick," but I don't recall before > having to do anything other than run the pg_restore command. Anyway, > thanks to everyone for all your help! My guess is that previously the dump command was actually: /opt/local/lib/postgresql84/bin/pg_dump -Fc -f ./Trading-Access -Z 5 Trading-Access -- Adrian Klaver adrian.klaver@gmail.com
On 26 June 2010 00:59, Dennis C <dcswest@gmail.com> wrote: > OK well the gunzip seemed to "do the trick," but I don't recall before > having to do anything other than run the pg_restore command. Anyway, thanks > to everyone for all your help! > > > On Fri, Jun 25, 2010 at 11:29 AM, Adrian Klaver <adrian.klaver@gmail.com> > wrote: >> >> On 06/25/2010 09:04 AM, Dennis C wrote: >>> >>> It says "Trading-Access: gzip compressed data, from Unix" >>> >>> About the idea of not using pg_restore for these dumps, what I'm still >>> missing is how it's worked for all these years before. Are there now >>> more >>> stringent standards being enforced? >>> >>> >> >> You have restored from these dumps using pg_restore? >> >> The command below says create a plain text file that has commands to clean >> database objects before recreating and store text in file ./Trading-Access >> using gzip compression at level 5: >> >> /opt/local/lib/postgresql84/bin/pg_dump -c -f ./Trading-Access -Z 5 >> Trading-Access >> >> To restore I would think you need to gunzip ./Trading-Access and then feed >> the file to psql. >> >> It appears that if you don't specify the file format, but you specify compression, it uses plain format but then gzips it up. Thom
On 26 June 2010 00:59, Dennis C <dcswest@gmail.com> wrote: > OK well the gunzip seemed to "do the trick," but I don't recall before > having to do anything other than run the pg_restore command. Anyway, thanks > to everyone for all your help! > > > On Fri, Jun 25, 2010 at 11:29 AM, Adrian Klaver <adrian.klaver@gmail.com> > wrote: >> >> On 06/25/2010 09:04 AM, Dennis C wrote: >>> >>> It says "Trading-Access: gzip compressed data, from Unix" >>> >>> About the idea of not using pg_restore for these dumps, what I'm still >>> missing is how it's worked for all these years before. Are there now >>> more >>> stringent standards being enforced? >>> >>> >> >> You have restored from these dumps using pg_restore? >> >> The command below says create a plain text file that has commands to clean >> database objects before recreating and store text in file ./Trading-Access >> using gzip compression at level 5: >> >> /opt/local/lib/postgresql84/bin/pg_dump -c -f ./Trading-Access -Z 5 >> Trading-Access >> >> To restore I would think you need to gunzip ./Trading-Access and then feed >> the file to psql. >> >> It appears that if you don't specify the file format, but you specify compression, it uses plain format but then gzips it up. Thom
That was it exactly as I just tested the entire process and it all worked fine again. For some reason, I inadvertently replaced the "-Fc" part with a "-c" somewhere along the way. Thanks again!
On Fri, Jun 25, 2010 at 5:18 PM, Adrian Klaver <adrian.klaver@gmail.com> wrote:
On Friday 25 June 2010 4:59:17 pm Dennis C wrote:My guess is that previously the dump command was actually:
> OK well the gunzip seemed to "do the trick," but I don't recall before
> having to do anything other than run the pg_restore command. Anyway,
> thanks to everyone for all your help!
/opt/local/lib/postgresql84/bin/pg_dump -Fc -f ./Trading-Access -Z 5
Trading-Access
--