I’ve long had issues with PostgreSQL 8.3 and now 8.4 refusing to start on my laptop which is really a pain for live demonstrations of ERDAS Apollo. I’m not sure if anyone else has similar problems, but I believe (or rather have a hunch) that it is something to do with “ungraceful” shutdowns of the db when you may lose power or consistently go to sleep. Its only ever occured on my laptop, so luckily postgres on a server is still stable as hell.
If you are getting something like the following in postgresql.log on Windows or are just tearing your hair out wondering why the service that was working before is no longer starting …
2009-12-04 09:05:37 WSTLOG:Â database system is ready to accept connections
FATAL:Â could not reattach to shared memory (key=240, addr=02690000): 487
2009-12-04 09:05:38 WSTLOG:Â autovacuum launcher started
2009-12-04 09:05:38 WSTLOG:Â background writer process (PID 9712) exited with exit code 1
2009-12-04 09:05:38 WSTLOG:Â terminating any other active server processes
2009-12-04 09:05:38 WSTLOG:Â all server processes terminated; reinitializing
2009-12-04 09:05:48 WSTFATAL:Â pre-existing shared memory block is still in use
2009-12-04 09:05:48 WSTHINT:Â Check if there are any old server processes still running, and terminate them.
To reliably fix things for me anyway,
- Delete postmaster.opts or postmaster.pid (if they exist) in your postgres data dir
- Kill the pg_ctl.exe process (if running)
- Start the postgres service