0

I'm using Windows 10. I recently had a system failure that required me to resinstall windows and most of my software. I also had to reinstall PostGres. I didn't have an opportunity to make any backups, but my data directory was on a separate, encrypted drive and it's still accessible. The data files are HUGE as I'm working with huge repo of data from an educational institution.

Postgres reinstalled fine. I tested it, then stopped the service, updated the registry entry for the postgres ImagePath to the data directory I wish to use, and verified the change in the Windows service panel.

But: I can't start the postgres service after adding the updated data directory, trying to log in through phpPgAdmin fails, and the Postgres log in the relevant data directory is not being updated. I've retried these steps a dozen times to make sure I'm not making any errors.

If I change the data directory back to default, everything works fine.

I am using PostGres 9.4, which is the same version I had before. I tried with a newer version of postGres too. What am I missing here? I don't have access to all of the database sql files I originally used so I really need to access this data directory again!

Thanks in advance for any tips you can provide.

UPDATE:

Progress! I didn't think to check event viewer. It revealed a few errors and I have resolved all but one:

FATAL: database files are incompatible with server DETAIL: database cluster was initialized with PG_CONTROL_VERSION 1100, but the server was compiled with PG_CONTROL_VERSION 942. HINT: It looks like you need to initdb.

When I reinstalled PG I grabbed v11 and tried to connect to my old data dir. It failed, so I uninstalled v11 and installed v9.4. It must have updated something when I tried the wrong version. I'm not sure what it's saying when it asks me to initdb.

8
  • duplicate of/related to: stackoverflow.com/questions/27349216/…
    – sm4rk0
    Aug 13, 2019 at 7:50
  • You need the error messages from pg_ctl.exe. Check with the event viewer, or start pg_ctl.exe in a console, not as a service. See pg_ctl manual page Aug 14, 2019 at 21:40
  • Progress! I didn't think to check event viewer. It revealed a few errors and I have resolved all but one: FATAL: database files are incompatible with server DETAIL: database cluster was initialized with PG_CONTROL_VERSION 1100, but the server was compiled with PG_CONTROL_VERSION 942. HINT: It looks like you need to initdb. When I reinstalled PG I grabbed v11 and tried to connect to my old data dir. It failed, so I uninstalled v11 and installed v9.4. It must have updated something when I tried the wrong version. I'm not sure what it's saying when it asks me to initdb.
    – Tamra R
    Aug 14, 2019 at 23:07
  • initdb is only for starting a new datadir from scratch, you don't want that. Having the PG 9.4 binaries installed, you need to point the 9.4 pg_ctl to the 9.4 data on your separate drive. The datadir can be passed as the -D argument to pg_ctl.exe. I read that you have changed an ImagePath entry in the registry to that effect, but that method is not documented in pg_ctl manual. Where does that come from? Aug 15, 2019 at 17:02
  • I used the method on this page to change the data dir via the registry: dbrnd.com/2016/08/… I just tried your suggested approach using pg_ctl to pass the data dir as a -D parameter and it produced the exact same result: "The database cluster was initialized with PG_CONTROL_VERSION 1100, but the server was compiled with PG_CONTROL_VERSION 942. HINT: It looks like you need to initdb."
    – Tamra R
    Aug 16, 2019 at 18:27

0

You must log in to answer this question.

Browse other questions tagged .