Restore backup file "with oids"

Started by gmail Vladimir Kokovićabout 6 years ago5 messages
#1gmail Vladimir Koković
vladimir.kokovic@gmail.com

Hi,

Is there somewhere a script that can do a restore backup file "with
oids" in some newer DB where there is no term "with oids"?

Vladimir Koković, DP senior(69)

Serbia, Belgrade, 18.December 2019

#2Fabrízio de Royes Mello
fabriziomello@gmail.com
In reply to: gmail Vladimir Koković (#1)
Re: Restore backup file "with oids"

On Wed, Dec 18, 2019 at 2:28 PM gmail Vladimir Koković <
vladimir.kokovic@gmail.com> wrote:

Hi,

Is there somewhere a script that can do a restore backup file "with oids"
in some newer DB where there is no term "with oids"?

Short answer: No!

Long answer: try use the pg_dump binary from your new version (12)
connecting to your old version... is the best practice when you want to
upgrade your PostgreSQL using dump/restore strategy.

Regards,

--
Fabrízio de Royes Mello Timbira - http://www.timbira.com.br/
PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

#3Heikki Linnakangas
hlinnaka@iki.fi
In reply to: gmail Vladimir Koković (#1)
Re: Restore backup file "with oids"

On 18 December 2019 19:28:07 EET, "gmail Vladimir Koković" <vladimir.kokovic@gmail.com> wrote:

Is there somewhere a script that can do a restore backup file "with
oids" in some newer DB where there is no term "with oids"?

There is nothing automatic, some manual work is needed. A couple of ideas:

1. Install an older version of PostgreSQL that still supports WITH OIDS, and restore the dump there. Use ALTER TABLE SET WITHOUT OIDS, and dump the database again (preferably with v12 of pg_dump).

2. Create the table manually, but with a regular oid-type column in place of the system column. Do a data-only restore.

You didn't mention what format the backup dump is. If it's in custom format, you can do a data-only restore easily. If it's a text sql file, and it's not too large, you can load it in a text exitor and edit manually.

- Heikki

#4Vladimir Koković
vladimir.kokovic@a-asoft.com
In reply to: Heikki Linnakangas (#3)
Re: Restore backup file "with oids"

HI,

The first thing I have to say is that I only have a plain backup file
"with oids" from "PostgreSQL 8.4.2, 32-bit",

from which I should take the contents of some tables.
Any help from someone who was in a similar situation would help me a lot
in resolving this situation.

Thank you Heikki for your solution.

Vladimir Koković, DP senior(69)

Serbia, Belgrade, 18.December 2019

Show quoted text

On 18.12.19. 19:34, Heikki Linnakangas wrote:

On 18 December 2019 19:28:07 EET, "gmail Vladimir Koković" <vladimir.kokovic@gmail.com> wrote:

Is there somewhere a script that can do a restore backup file "with
oids" in some newer DB where there is no term "with oids"?

There is nothing automatic, some manual work is needed. A couple of ideas:

1. Install an older version of PostgreSQL that still supports WITH OIDS, and restore the dump there. Use ALTER TABLE SET WITHOUT OIDS, and dump the database again (preferably with v12 of pg_dump).

2. Create the table manually, but with a regular oid-type column in place of the system column. Do a data-only restore.

You didn't mention what format the backup dump is. If it's in custom format, you can do a data-only restore easily. If it's a text sql file, and it's not too large, you can load it in a text exitor and edit manually.

- Heikki

#5David G. Johnston
david.g.johnston@gmail.com
In reply to: Vladimir Koković (#4)
Re: Restore backup file "with oids"

On Wednesday, December 18, 2019, Vladimir Koković <
vladimir.kokovic@a-asoft.com> wrote:

HI,

The first thing I have to say is that I only have a plain backup file
"with oids" from "PostgreSQL 8.4.2, 32-bit",

from which I should take the contents of some tables.
Any help from someone who was in a similar situation would help me a lot
in resolving this situation

Restore it into 9.4 and see if you can get what you need from there?

David J.