Re: restore a pg_dumpall only breaks

From: Marc Fromm <Marc(dot)Fromm(at)wwu(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: restore a pg_dumpall only breaks
Date: 2016-11-24 23:33:40
Message-ID: CY1PR0201MB143628C631F61E62D49B86CC9DB60@CY1PR0201MB1436.namprd02.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> If you're working with locally-built copies of Postgres, I'd say just follow the recipe given in the pg_upgrade man page. If you are working with someone's packaged version of Postgres, the packager may have provided a script or something for upgrades, in which case follow their recommendation. Either way it's a good idea to make a backup beforehand in case of disaster.

Postgresql was installed during the install of centOS 6.4. Postgresql was an install option. Thus I figure I am working with "someone's packaged version.

No need for database backup since the backups are from a different server (9.2), which has prompted all of this. If I copy the entire pgsql directory and thing blow up can I just replace the copied directory with its contents and be restored to 8.4?

I downloaded pgdg-centos92-9.2-8.noarch.rpm for CentOS6.4 from https://yum.postgresql.org/repopackages.php#pg92. Is there more involved then using yum to uninstall 8.4 and then use yum to install 9.2?

Thanks

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Thursday, November 24, 2016 10:22 AM
To: Marc Fromm <Marc(dot)Fromm(at)wwu(dot)edu>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: [ADMIN] restore a pg_dumpall only breaks

Marc Fromm <Marc(dot)Fromm(at)wwu(dot)edu> writes:
>> A dump from 9.2 is no sure thing to restore into an 8.1 database; there may be SQL syntax in it that 8.1 doesn't understand. Have you checked for errors during the restore?

> After the last successful database restore from the pg_dumpall file this is displayed on the ssh session.
> psql:pg_dbs.bkp:1029100: \connect: invalid connection option "-reuse-previous"

Ah. That option was introduced quite recently as part of a security fix.
It's no surprise 8.x doesn't recognize it.

You could probably work around this by using pg_dumpall with -g to just dump roles and tablespaces, and then pg_dump'ing individual databases separately. A mite tedious and error-prone. Or maybe use "sed" to strip out the -reuse-previous options from pg_dumpall's output. But really this is the best answer, because 8.x is long out of support:

> I figure the best thing to do is to upgrade postgres 8.4 (not 8.1 as previously mentioned) to 9.2 on this centOS6.4 server, so it's version matches the other server. I searched for some time on how to do this and every tutorial does it a little different and each has different steps that the others do not have. Is there a clear step by step procedure to do this upgrade?

If you're working with locally-built copies of Postgres, I'd say just follow the recipe given in the pg_upgrade man page. If you are working with someone's packaged version of Postgres, the packager may have provided a script or something for upgrades, in which case follow their recommendation. Either way it's a good idea to make a backup beforehand in case of disaster.

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Marc Fromm 2016-11-25 05:36:04 Re: restore a pg_dumpall only breaks
Previous Message Alvaro Herrera 2016-11-24 19:51:29 Re: Replica lag, high read IO, vacuum index scanning bug?