I have unfortunately broken my old machine with postgres 8.3 on debian 6.0, I found a directory backup of postgresql database files, and i try to copy them on the new machine with a new version of postgres 9.1, but postgres on start fail with error:
[FAIL with server 2022-05-05 14:22:42 GMT DETAIL: The data directory was initialized by PostgreSQL version 8.3, which is not compatible with this version 9.1.21. ... failed! failed!
I found several guides explaining how to upgrade from an older version to a newer one, but these only work if you have the old version installed and working, in my case I can't install the old one anymore as postgresql 8.3 is no longer supported. How can I recover the old db and data?
Update..., this all command that I runnig:
#initialize db
/usr/local/pgsql/bin/initdb -D pgdata
#copy original files
cp -r /var/lib/postgresql/8.3/main/* pgdata/
#start server
/usr/local/pgsql/bin/pg_ctl -D ./pgdata -l logfile start
>server starting
#check log
tail logfile
> FATAL: database "DB2" does not exist
> FATAL: database "DB0" does not exist
> FATAL: database "DB1" does not exist
> FATAL: database "DB2" does not exist
> FATAL: database "DB0" does not exist
> FATAL: database "DB1" does not exist
> FATAL: database "DB2" does not exist
> FATAL: database "DB0" does not exist
> FATAL: database "DB1" does not exist
> FATAL: database "DB2" does not exist
/usr/local/pgsql/bin/psql
psql: FATAL: database "postgres" does not exist
/usr/local/pgsql/bin/pg_dumpall > db.out
> pg_dumpall: could not connect to database "template1": FATAL: database "template1" does not exist
@Laurenz Albe
You have to install 8.3, probably from source, on a machine with the same architecture. Then copy the complete data directory to that machine and start the server on it.
Now
pg_dumpall
the cluster and restore it to PostgreSQL v14.You should not run
initdb
at all. Instead,If the data directory was complete, you should be able to start the server after that.