pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Juan Miguel <juanmime@ono.com>
To: pgsql-admin@postgresql.org
Subject: Re: Fw: Postgres 7.3, pg_dump, pg_restore and "lo" type
Date: Wed, 30 Apr 2003 00:01:34 +0200
Message-ID: <200304300001.35071.juanmime@ono.com> (raw)
In-Reply-To: <002701c30de0$07517480$0400a8c0@frijid.net>
References: <002701c30de0$07517480$0400a8c0@frijid.net>

> Juan - if you look back in the posts to 4/21, you'll see a thread titled
> "[ADMIN] trouble migrating large objects from 7.1.3 to 7.3.2".  In there,
> you'll see I was having a similar problem.  I discovered that using the -o
> option of pg_dump was causing the tar archiver error.  As it turns out,
> most people don't need the -o option.
>
> If you can, I'd try re-running pg_dump & pg_restore without the -o option.
> If you can't rerun pg_dump or you really need the -o option for pg_dump,
> then I'm not sure how to proceed.  I couldn't get it to work either, but
> luckily I didn't need it.

First, thanks to everybody who tried to help me in this trouble.

After thinking a long time, I have found one solution. This solution has steps 
that are individuals for each database, but are very simple. I remember that 
I use the version 7.3.0, I think that in 7.3.2, some steps could be jumped.

Here is, how to restore a database dump, in Postgres 7.3, that uses the "lo" 
type of the contrib dir. I explain the steps of this "algorithm" for 
everybody who have the same problem as me.

MAKING THE BACKUP
-----------------------------------
1. We have the dump in a tar file, made with something similar to:
	pg_dump -Ft -o -b -U myuser mydb > backup.tar

THE RESTORING PROCESS
--------------------------------------------
2. We drop de database, if it exists.
	dropdb -U myuser mydb

3. We restore the structure of the database and create it. Use something 
similiar to:
	pg_restore -Ft -v -s -C -U myuser -d test backup.tar

4. We access with "psql" to the database and create a implicit cast of the 
types "lo" and "oid" on both directions.

5. We delete the triggers in the tables with "lo" columns, that calls the 
function "lo_manage".

6.- We restore the data of the database.
	pg_restore -Ft -v -a  -U myuser -d mydb backup.tar

7.- We create the triggers (again) deleted, in the step 5.

I said that this "algorithm" depends on the particular database that we used, 
because the steps (5 and 7).

I think that these steps (5 and 7) could be converted to an database 
sistematic database independient step. Therefore if someone can improve this 
solution, write to me and we'll speak.

Bye.

Juan Miguel Moreno Escar
     juanmime@ono.com




view thread (4+ messages)

Message-ID: <200304300001.35071.juanmime@ono.com>
Permalink:  ../200304300001.35071.juanmime@ono.com/
Also on:    postgresql.org/message-id/200304300001.35071.juanmime@ono.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: juanmime@ono.com
  Subject: Re: Fw: Postgres 7.3, pg_dump, pg_restore and "lo" type
  In-Reply-To: <200304300001.35071.juanmime@ono.com>
  References: <002701c30de0$07517480$0400a8c0@frijid.net> <200304300001.35071.juanmime@ono.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox