pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Retore Postgres DB without dump
4+ messages / 3 participants
[nested] [flat]

* Retore Postgres DB without dump
@ 2008-04-11 14:14 Baudrion Philippe <Philippe.Baudrion@adm.unige.ch>
  2008-04-11 16:40 ` Re: Retore Postgres DB without dump Andrew Sullivan <ajs@crankycanuck.ca>
  2008-04-11 16:50 ` Re: Retore Postgres DB without dump Shane Ambler <pgsql@Sheeky.Biz>
  0 siblings, 2 replies; 4+ messages in thread

From: Baudrion Philippe @ 2008-04-11 14:14 UTC (permalink / raw)
  To: pgsql-admin

Hello all,
I had a look at your last year archive without finding my solution, but 
I suppose it's a common problem.
I am trying to restore an old database from their relations files, I 
don't have any dump, is it possible and how ?

System information:
Original - db: Postgres v.7.4, OS: Linux Mandriva 2006
Current - db: Postgres v.8.1.11, OS: Suse SLES10sp1

What I have tried is :
- To copy the files directly in an empyty db, I got a message like this 
when trying to connect: "Error: wrong files version, these are 7.4 files 
version and you are running 8.1"
- So, I have build and installed a 7.4 version of Postgres
- Copy the files in an empty database
- Connection was ok, but "\dt" told me "no relations found".

What can I try next ?
I also have the original "pg_clog" and "pg_xlog" directories, and I have 
also tried to replace them. What can I do with the WAL segments ?

Thanks for your help,
Philippe



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Retore Postgres DB without dump
  2008-04-11 14:14 Retore Postgres DB without dump Baudrion Philippe <Philippe.Baudrion@adm.unige.ch>
@ 2008-04-11 16:40 ` Andrew Sullivan <ajs@crankycanuck.ca>
  1 sibling, 0 replies; 4+ messages in thread

From: Andrew Sullivan @ 2008-04-11 16:40 UTC (permalink / raw)
  To: pgsql-admin

On Fri, Apr 11, 2008 at 04:14:05PM +0200, Baudrion Philippe wrote:
> - So, I have build and installed a 7.4 version of Postgres
> - Copy the files in an empty database
> - Connection was ok, but "\dt" told me "no relations found".
> 
> What can I try next ?
> I also have the original "pg_clog" and "pg_xlog" directories, and I have 
> also tried to replace them. What can I do with the WAL segments ?

If you didn't put everything back in the same place, you won't get a data
area.  Just start up the 7.4 back end against the entire data tree of the
old 7.4 installation.

a




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Retore Postgres DB without dump
  2008-04-11 14:14 Retore Postgres DB without dump Baudrion Philippe <Philippe.Baudrion@adm.unige.ch>
@ 2008-04-11 16:50 ` Shane Ambler <pgsql@Sheeky.Biz>
  2008-04-14 08:58   ` Re: Retore Postgres DB without dump Baudrion Philippe <Philippe.Baudrion@adm.unige.ch>
  1 sibling, 1 reply; 4+ messages in thread

From: Shane Ambler @ 2008-04-11 16:50 UTC (permalink / raw)
  To: Philippe.Baudrion@adm.unige.ch; +Cc: pgsql-admin

Baudrion Philippe wrote:
> Hello all,
> I had a look at your last year archive without finding my solution, but 
> I suppose it's a common problem.
> I am trying to restore an old database from their relations files, I 
> don't have any dump, is it possible and how ?

Get the old version running again and perform the dump. Then restore to 
the new version.

> System information:
> Original - db: Postgres v.7.4, OS: Linux Mandriva 2006
> Current - db: Postgres v.8.1.11, OS: Suse SLES10sp1

The first question is whether the new server is amd64?
If you are trying to open the old 32 bit server files on the new 64 bit 
one this may be the issue.

Are you trying to get 7.4 running on the old hardware/OS or the new 
hardware/OS?

Or have you installed the new OS onto the same machine?

> What I have tried is :
> - To copy the files directly in an empyty db, I got a message like this 
> when trying to connect: "Error: wrong files version, these are 7.4 files 
> version and you are running 8.1"

Minor updates (the third version digit) can read the same files, major 
upgrades (the first two digits) require a dump from the old version 
followed by a restore into the new version.

> - So, I have build and installed a 7.4 version of Postgres
> - Copy the files in an empty database
> - Connection was ok, but "\dt" told me "no relations found".

Exact copy of the entire data folder?

Which 7.4.x? 7.4.19 is the latest and may have fixes that address this.

If there is damage to the data files a few of the others here can help.
You will want to be running 7.4.19 first.

> What can I try next ?
> I also have the original "pg_clog" and "pg_xlog" directories, and I have 
> also tried to replace them. What can I do with the WAL segments ?

Start with a copy of the original files you backed up. Install the 
newest update for 7.4 and try pg_dumpall from there. You may also try 
using pg_dumpall 8.1.x (or 8.3) to dump from the 7.4 server.

When you have a dump file that looks reasonable try restoring it into 
your new server.

If this is an old and new server you can pipe the dump output to psql 
sending it straight to the new server.


-- 

Shane Ambler
pgSQL (at) Sheeky (dot) Biz

Get Sheeky @ http://Sheeky.Biz



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Retore Postgres DB without dump
  2008-04-11 14:14 Retore Postgres DB without dump Baudrion Philippe <Philippe.Baudrion@adm.unige.ch>
  2008-04-11 16:50 ` Re: Retore Postgres DB without dump Shane Ambler <pgsql@Sheeky.Biz>
@ 2008-04-14 08:58   ` Baudrion Philippe <Philippe.Baudrion@adm.unige.ch>
  0 siblings, 0 replies; 4+ messages in thread

From: Baudrion Philippe @ 2008-04-14 08:58 UTC (permalink / raw)
  To: pgsql-admin

Thanks for all your advices, it worked perfectly.
I only had to build again postgres with the option : ./configure 
--enable-integer-datetimes
due to the error:
"DETAIL:  The database cluster was initialized
without HAVE_INT64_TIMESTAMP but the server was compiled with
HAVE_INT64_TIMESTAMP.
I did a dump and restore the db in the new server.
Philippe

Shane Ambler wrote:
> Baudrion Philippe wrote:
>> Hello all,
>> I had a look at your last year archive without finding my solution, 
>> but I suppose it's a common problem.
>> I am trying to restore an old database from their relations files, I 
>> don't have any dump, is it possible and how ?
>
> Get the old version running again and perform the dump. Then restore 
> to the new version.
>
>> System information:
>> Original - db: Postgres v.7.4, OS: Linux Mandriva 2006
>> Current - db: Postgres v.8.1.11, OS: Suse SLES10sp1
>
> The first question is whether the new server is amd64?
> If you are trying to open the old 32 bit server files on the new 64 
> bit one this may be the issue.
>
> Are you trying to get 7.4 running on the old hardware/OS or the new 
> hardware/OS?
>
> Or have you installed the new OS onto the same machine?
>
>> What I have tried is :
>> - To copy the files directly in an empyty db, I got a message like 
>> this when trying to connect: "Error: wrong files version, these are 
>> 7.4 files version and you are running 8.1"
>
> Minor updates (the third version digit) can read the same files, major 
> upgrades (the first two digits) require a dump from the old version 
> followed by a restore into the new version.
>
>> - So, I have build and installed a 7.4 version of Postgres
>> - Copy the files in an empty database
>> - Connection was ok, but "\dt" told me "no relations found".
>
> Exact copy of the entire data folder?
>
> Which 7.4.x? 7.4.19 is the latest and may have fixes that address this.
>
> If there is damage to the data files a few of the others here can help.
> You will want to be running 7.4.19 first.
>
>> What can I try next ?
>> I also have the original "pg_clog" and "pg_xlog" directories, and I 
>> have also tried to replace them. What can I do with the WAL segments ?
>
> Start with a copy of the original files you backed up. Install the 
> newest update for 7.4 and try pg_dumpall from there. You may also try 
> using pg_dumpall 8.1.x (or 8.3) to dump from the 7.4 server.
>
> When you have a dump file that looks reasonable try restoring it into 
> your new server.
>
> If this is an old and new server you can pipe the dump output to psql 
> sending it straight to the new server.
>
>

-- 
Baudrion Philippe
Université de Genève - ETI
40, bd. du Pont d'Arve
1211 GENEVE 4

Tel : +41 22 379 94 95




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2008-04-14 08:58 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-04-11 14:14 Retore Postgres DB without dump Baudrion Philippe <Philippe.Baudrion@adm.unige.ch>
2008-04-11 16:40 ` Andrew Sullivan <ajs@crankycanuck.ca>
2008-04-11 16:50 ` Shane Ambler <pgsql@Sheeky.Biz>
2008-04-14 08:58   ` Baudrion Philippe <Philippe.Baudrion@adm.unige.ch>

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