How to recover data from 9.3 data directory

Started by Andrusabout 5 years ago11 messagesgeneral
Jump to latest
#1Andrus
kobruleht2@hot.ee

Hi!

There is data directory from Postgres 9.3 server from old Centos.

Centos server is not running anymore and there is window 10 workstation
to recover.

1. Tried to recover data from it installing 9.3 and 13 servers in
windows 10 and using

"C:\Program Files\PostgreSQL\13\bin\pg_upgrade.exe" ^
--old-datadir "D:/Centos93Data/data" ^
--new-datadir "C:/Program Files/PostgreSQL/13/data" ^
--old-bindir "C:/Program Files/PostgreSQL/9.3/bin" ^
--new-bindir "C:/Program Files/PostgreSQL/13/bin"

It complained that postmaster seems working. I deleted postmaster.pid
file. Now it throws  error

Performing Consistency Checks
Checking cluster versions ok
The source cluster was not shut down cleanly.
Failure, exiting

2. Tried to run old server using

C:\Program Files\PostgreSQL\9.3\bin\pg_ctl.exe" start -D
"D:/Centos93Data/data"

got error

FATAL:  database files are incompatible with server

DETAIL:  The database cluster was initialized with USE_FLOAT8_BYVAL but
the server was compiled without USE_FLOAT8_BYVAL.
HINT:  It looks like you need to recompile or initdb.

I tried both 32 and 64 bit 9.3 servers in windows but error is the same.

How to recover data from 9.3 linux directory ?

Andrus.

#2Julien Rouhaud
rjuju123@gmail.com
In reply to: Andrus (#1)
Re: How to recover data from 9.3 data directory

Le sam. 13 mars 2021 à 21:29, Andrus <kobruleht2@hot.ee> a écrit :

2. Tried to run old server using

C:\Program Files\PostgreSQL\9.3\bin\pg_ctl.exe" start -D

"D:/Centos93Data/data"
got error

FATAL: database files are incompatible with server
DETAIL: The database cluster was initialized with USE_FLOAT8_BYVAL but
the server was compiled without USE_FLOAT8_BYVAL.
HINT: It looks like you need to recompile or initdb.

I tried both 32 and 64 bit 9.3 servers in windows but error is the same.

How to recover data from 9.3 linux directory ?

that won't work on windows. pg_upgrade only works if source and target
environment are binary compatible, which isn't the case for windows / GNU
Linux.

Show quoted text
#3Andrus
kobruleht2@hot.ee
In reply to: Julien Rouhaud (#2)
Re: How to recover data from 9.3 data directory

Hi!

that won't work on windows. pg_upgrade only works if source and

target environment are binary compatible, which isn't the case for
windows / GNU Linux.

wal archiving works between Linux and Windows. So I expected those
commands to work also.

How to determine is this data from 32 or 64 bit server ?

Should I create virtual machine and install Linux with 9.3 into it or is
there simpler solution?

Will data from 32 bit server require 32 bit Linux with 32 bit postgres
or will it work with 64 bit Linux also ?

Andrus.

#4Julien Rouhaud
rjuju123@gmail.com
In reply to: Andrus (#3)
Re: How to recover data from 9.3 data directory

Le sam. 13 mars 2021 à 22:02, Andrus <kobruleht2@hot.ee> a écrit :

Hi!

that won't work on windows. pg_upgrade only works if source and target

environment are binary compatible, which isn't the case for windows / GNU
Linux.

wal archiving works between Linux and Windows. So I expected those
commands to work also.

WAL archiving is only a file copy, you can copy them anywhere without
restrictions on the architecture.

How to determine is this data from 32 or 64 bit server ?

it's not really a question of the binary pointer size but the target
hardware specificity.

Should I create virtual machine and install Linux with 9.3 into it or is
there simpler solution?

that's the only option, unless you already have some compatible server
around.

Will data from 32 bit server require 32 bit Linux with 32 bit postgres or
will it work with 64 bit Linux also ?

I think that it won't matter and a 64 bits server will work just fine, but
only testing will give a definite answer.

Show quoted text
#5Andrus
kobruleht2@hot.ee
In reply to: Julien Rouhaud (#4)
Re: How to recover data from 9.3 data directory

Should I create virtual machine and install Linux with 9.3 into it
or is there simpler solution?

that's the only option, unless you already have some compatible server
around.

I have new Debian virtual machine with Postgres 12  .

Debian does not offer to install Postgres 9.3 into it. How to install
postgres 9.3 in new Debian ?

Andrus.

#6Guillaume Lelarge
guillaume@lelarge.info
In reply to: Andrus (#5)
Re: How to recover data from 9.3 data directory

Le sam. 13 mars 2021 à 15:18, Andrus <kobruleht2@hot.ee> a écrit :

Should I create virtual machine and install Linux with 9.3 into it or is

there simpler solution?

that's the only option, unless you already have some compatible server
around.

I have new Debian virtual machine with Postgres 12 .

Debian does not offer to install Postgres 9.3 into it. How to install
postgres 9.3 in new Debian ?

You'll have to compile it.

--
Guillaume.

#7Andrus
kobruleht2@hot.ee
In reply to: Guillaume Lelarge (#6)
Re: How to recover data from 9.3 data directory

Hi!

Debian does not offer to install Postgres 9.3 into it. How to install

postgres 9.3 in new Debian ?

You'll have to compile it.

Enterpisedb offers 9.3 download for Linux in
https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

Maybe it is possible to install it in new Debian ?

Or is it possible to download ISO image with Postgres 9.3 installed ?

Or should I try to find old Debian ISO image and install it into this?

Andrus.

#8Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Andrus (#7)
Re: How to recover data from 9.3 data directory

On 3/13/21 7:25 AM, Andrus wrote:

Hi!

Debian does not offer to install Postgres 9.3 into it. How to install

postgres 9.3 in new Debian ?

You'll have to compile it.

Enterpisedb offers 9.3 download for Linux in
https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

Maybe it is possible to install it in new Debian ?

Or is it possible to download ISO image with Postgres 9.3 installed ?

Or should I try to find old Debian ISO image and install it into this?

Or you could just use the the Postgres APT repo, as example:

https://apt.postgresql.org/pub/repos/apt/dists/stretch-pgdg/9.3/

Andrus.

--
Adrian Klaver
adrian.klaver@aklaver.com

#9Julien Rouhaud
rjuju123@gmail.com
In reply to: Adrian Klaver (#8)
Re: How to recover data from 9.3 data directory

Le dim. 14 mars 2021 à 00:17, Adrian Klaver <adrian.klaver@aklaver.com> a
écrit :

On 3/13/21 7:25 AM, Andrus wrote:

Hi!

Debian does not offer to install Postgres 9.3 into it. How to install

postgres 9.3 in new Debian ?

You'll have to compile it.

Enterpisedb offers 9.3 download for Linux in
https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

Maybe it is possible to install it in new Debian ?

Or is it possible to download ISO image with Postgres 9.3 installed ?

Or should I try to find old Debian ISO image and install it into this?

Or you could just use the the Postgres APT repo, as example:

https://apt.postgresql.org/pub/repos/apt/dists/stretch-pgdg/9.3/

see also
https://wiki.postgresql.org/wiki/Apt/FAQ#Where_are_older_versions_of_the_packages.3F

Show quoted text
#10Andrus
kobruleht2@hot.ee
In reply to: Julien Rouhaud (#9)
Re: How to recover data from 9.3 data directory
#11Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Andrus (#10)
Re: How to recover data from 9.3 data directory

On 3/13/21 12:04 PM, Andrus wrote:

Or you could just use the the Postgres APT repo, as example:

https://apt.postgresql.org/pub/repos/apt/dists/stretch-pgdg/9.3/
<https://apt.postgresql.org/pub/repos/apt/dists/stretch-pgdg/9.3/&gt;

see also
https://wiki.postgresql.org/wiki/Apt/FAQ#Where_are_older_versions_of_the_packages.3F
<https://wiki.postgresql.org/wiki/Apt/FAQ#Where_are_older_versions_of_the_packages.3F&gt;

I discovered that Debian allows to install 9.3 side-by side with 12

As long as you are using the PGDG(Postgres) repos and Debian versions
listed here:

https://www.postgresql.org/download/linux/debian/#apt

apt-get install postgresql-9.3

Andrus.

--
Adrian Klaver
adrian.klaver@aklaver.com