Sorry, I don't have enough rep to participate in the comments yet, but I use PostgreSQL a lot on Linux and Windows.
I ran into this same problem the other day. I ran the 9.1.7 installer and it broke my clusters. As Mike Christensen said, the key is running pg_ctl START in a command window to get a useful error message.
I got the command to use from the Services panel. When you view properties on your cluster definition, you'll see the pg_ctl command to start the service. Copy that command and paste it into the command window, then change the "runservice" parameter to "start", and use runas.exe
to launch the command as the postgres
user (9.1 and below) or LOCALSERVICE
account (later versions).
It should already contain the path to your cluster data directory. This is what mine looks like:
C:/PROGRA~1/PostgreSQL/9.1/bin/pg_ctl.exe runservice -N "PostgreSQL Dev Cluster" -D "C:/PROGRA~1/PostgreSQL/9.1/data"
Check the error message you get from that command, and check the database logs also.
In my case I had two problems. First, I couldn't get the installer to work until I ran it under postgres local admin account. But when I did that, my domain account no longer had privileges. I had to re-grant myself full control on PostgreSQL directory tree. ( Edit CR: Don't mess with permissions on the PostgreSQL data directory unless you know exactly what you are doing, you are likely to make any problem much worse not better.)
Then I tried starting it again and got a different message indicating port 5432 was already in use. This turned out to be true. Somehow the installer had left an orphaned postgres.exe process open on port 5432, even though the Services panel showed that service as not started.
I had to use netstat -ano
to find the PID and kill the orphan from task manager. Then everything started normally.
Hope that helps.
Brian
Best Answer
You are facing data corruption, and it seems that your database had crashed before and now the recovery process is failing.
If you cannot restore from a backup, you will have to find a professional who can salvage as much from the wreck as possible. A Q&A forum will not be able to guide you through this.
Apart from that, you should figure out what may have caused the data corruption, so that you can avoid it in the future. Often the cause is hardware problems.